blob_id stringlengths 40 40 | content_id stringlengths 40 40 | repo_name stringlengths 5 114 | path stringlengths 5 318 | language stringclasses 5
values | extension stringclasses 12
values | length_bytes int64 200 200k | license_type stringclasses 2
values | content stringlengths 143 200k |
|---|---|---|---|---|---|---|---|---|
55cfba946efe6f99d0157a52e321081997c1ff92 | 81b3b91f80bd05a3d5a0a8ed8480e0c6295e66fa | sibo7851/Python-OOD-RPG- | /game/Python/StatStruct.py | Python | py | 1,502 | no_license | class Stats(object):
attack=0.0
defense=0.0
speed=0.0
maxHealth=0.0
currentHealth=0.0
maxMagic=0.0
currentMagic=0.0
accuracy=0.0
evasion=0.0
statusEffect=[]
money=0.0
credits=0.0
#overrides for multiplication and addition for applying single operations across all states.
def __mul__(self, other):
self.... |
aef30efd6ad88b75e81ccc08bcd6fed430bbe5d9 | febede8d2d170577be971f939e3482b4d4108b89 | mukulghezta/Online_Library | /Online_Library/urls.py | Python | py | 1,164 | no_license | """Online_Library URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Clas... |
86296d2b23e729cad5b3efad8955637ea09a5c4f | beff16efa8e7196a86cd7645ff09f556299b3712 | yzjbryant/YZJ_MIX_Code | /Zeolite_Ds_Analyze/Py/Cut_box_vi_top_CH4_MON.py | Python | py | 10,985 | no_license | import os
import sys
import re
folder_name=['MON']
folder_next=['1','2','3','4']
ds=[]
ds_line_x=[]
ds_line_y=[]
Number=[]
Number_atom=[]
for i in folder_name:
os.chdir('%s'%i)
#########################################
for j in folder_next[0]:
path='%s'%j
count... |
122f5bc053f090eb6d0999f9c04037ba768dcc35 | b686d277c876d335de1e68c5bbbe11957d85a298 | veltman/streets | /extract-nodes.py | Python | py | 1,018 | no_license | # Given an XML file with <nodes>, prints a TSV, each row is: NODE_ID LATITUDE LONGITUDE
from bs4 import BeautifulSoup
import sys
def escapeCell(cell):
"""Escape trailing backslashes and tabs from each field to prevent problem with MySQL import
"""
return cell.strip().strip('\\').replace('\t',' ')
def GetNodes(osm... |
4aa5e3fe4b55254e2e90d28122ca363c483cebd2 | 5ee243a7e27ebc1692bdc5506f377b3f48ab2c43 | chopranitish/LiverResponse | /DL_Template/ReturnGenerators.py | Python | py | 7,281 | no_license | __author__ = 'Brian M Anderson'
# Created on 11/18/2020
from DL_Template.ReturnPaths import return_paths, os
from Base_Deeplearning_Code.Data_Generators.TFRecord_to_Dataset_Generator import DataGeneratorClass
from Base_Deeplearning_Code.Data_Generators.Image_Processors_Module.Image_Processors_DataSet import *
def ret... |
1ddd1ed5a452857e301665195acb9cf609abd084 | 4027ce22eb6980da985aa2ef71f06d370cb877b6 | vanstoner/xld-mule-mc-plugin | /src/main/resources/requests_toolbelt/adapters/__init__.py | Python | py | 650 | no_license | #
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
#
# -*- coding: utf-8 -*-
"""
reque... |
19c35668f04dfa0db90caf10698390ece8959796 | ffff4ba7bfcfc16b5a7e43f8901bdc9390c1c568 | nathanvy/12steps | /step7/step7.py | Python | py | 1,675 | no_license | #/usr/bin/python
#2D diffusion
#
# du/dt = nu d2u/dx2 + nu d2u/dy2
#discretizes to:
#
# (u_n+1_i,j - u_n_i,j)/deltaT = nu( u_n_i+1,j - 2u_n_i,j + u_n_i-1,j)/deltaX + nu( u_n_i,j+1 - 2u_n_i,j + u_n_i,j-1)
# solving for the only unknown:
# u_n+1_i,j = u_n_i,j + nu dt/dx (u_n_i+1,j - 2u_n_i,j + u_n_i-1,j) + nu dt/dy(u_n_i... |
b357f02b0b2fe3414b33b921389688ab5f8c124b | 1d22b917f32f7d86219754d91ae460233b54052d | it-engineer-me/pyneng-examples | /ssh_telnet/scrapli/ex01_scrapli_basic_factory.py | Python | py | 1,155 | permissive | from scrapli import Scrapli
from scrapli.exceptions import ScrapliException
r1 = {
"host": "192.168.100.1",
"auth_username": "cisco",
"auth_password": "cisco",
"auth_secondary": "cisco",
"auth_strict_key": False,
"timeout_socket": 5, # timeout for establishing socket/initial connection in seco... |
f590811b18da3d3fe8194f20ace9345f7404eaa2 | 8876887634ab808edc8a9498d336001b364fb3c5 | srobertson/rambler | /Rambler/tests/old/testQueryParserBoth.py | Python | py | 2,112 | permissive | import unittest
from initRambler import txnStart, initialize
initialize("widget_doodle_relation_test.xml", "deployment_both.xml", "dbname=relation_test_both")
from Rambler import Server
from Rambler.tests.Widget import Widget
from Rambler.tests.Doodle import Doodle
from Rambler.QueryParser import QueryError, query2pg... |
93c1fb49f2a34eb2ec1aebd6fdb9d97c74766a27 | 8801bbb7d9b42d5844c87d268f7ee5141aa1a36e | Vishwajeet2610/STHC | /single and multiple.py | Python | py | 3,196 | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 29 16:19:12 2016
@author: Yogi...!
"""
import numpy as np
from scipy.optimize import fsolve
print ("select the no. of stages. 1.Single stage 2. Two stage")
Z= raw_input("enter the choice: ")
Z=float(Z)
if Z==1:
# SINGLE STAGE ADSORPTION
#S_s:... |
62744708b1a87646fd508a50fb0dfdb626c9675e | 6a7d5c2689bb9f5841ed42aebb8c4a78c5217994 | ukishere/DJ06 | /review/app/views.py | Python | py | 1,144 | no_license | from django.shortcuts import redirect, render, get_object_or_404
from django.urls import reverse
from .models import Product, Review
from .forms import ReviewForm
def product_list_view(request):
template = 'app/product_list.html'
products = Product.objects.all()
context = {
'product_list': produ... |
4d33b41f6154dabab2834b02431976484bd7e817 | af101ae0c10bef80e34e375af2ea6cb393f467a8 | yoshio-kinoshita/python-game | /ch3/3.3bool.py | Python | py | 690 | no_license | a = 3
if a:
print("true")
else:
print("false")
print(a)
print(bool(0.0))
print(bool(3.14))
print(bool({}))
print(bool({1, 2, 3}))
print(bool({"hello"}))
print(bool(""))
x = 10 if a > 0 else 20
print(x)
counter = 0
while counter < 3 :
print(counter)
counter += 1
total = 0
index = 0
subject = (78, ... |
5de0369714f9557ed927cd7f3ad1f4c63b078b7a | ed0dfbb77044803fb451618eb828e1e660c98266 | TinyTinni/gimp_svg_mask | /plug-ins/masked_svg.py | Python | py | 3,513 | permissive | #!/usr/bin/python
from gimpfu import *
from base64 import b64encode
from os.path import splitext
import gzip
svg_preamble = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'
svg_doctype = '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'
def img_referenc... |
11700e42912e640fe189a1bc2967ea688db868cc | dcffa27eb262b67d99bbcb29c29e0f6b60bc0153 | rtreharne/pvsat-dev | /message/migrations/0039_auto_20151007_1431.py | Python | py | 466 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('message', '0038_auto_20151007_1426'),
]
operations = [
migrations.AlterField(
model_name='messag... |
473784fe7d62e23495fea1660a85f43930eb6fdb | 45d9fba79ab13f4ad2f99d46383ac6a2ecb6d310 | un-knower/spark-in-action | /spark-2.x/src/main/python/mllib/hypothesis_testing_example.py | Python | py | 2,631 | permissive | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
c2ad5cb1453fe8d89f2aa08c693bc0bfb4f21d38 | bcb8ee4e0daa77dd45cda8c65b3e6de90f7cd9b5 | shaneutt/metallb | /tasks.py | Python | py | 39,657 | permissive | import ipaddress
import os
import semver
import re
import shutil
import sys
import yaml
import tempfile
import time
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
from invoke import run, task
from invoke.exceptions import Exit, UnexpectedExit
all_binaries = set(["contr... |
33ceb5b57bc9efbe4ec82028e51ea322c03baa12 | 3dbb90e4acefc47cc87bb3f102cfed273df7b950 | cash2one/xai | /xai/brain/wordbase/nouns/_southerly.py | Python | py | 318 | permissive |
#calss header
class _SOUTHERLY():
def __init__(self,):
self.name = "SOUTHERLY"
self.definitions = [u'a wind that comes from the south']
self.parents = []
self.childen = []
self.properties = []
self.jsondata = {}
self.specie = 'nouns'
def run(self, obj1 = [], obj2 = []):
return self.jsondata
|
7af77a7b2427bf10c3fa1956e80eaa70d0aa5755 | 77ef61b29d0d4f277050d71ef6afcdb405a56dd9 | codebergau/salt-formula-odoo9 | /tests/build/virtualenv/lib/python2.7/site-packages/salt/roster/__init__.py | Python | py | 2,718 | permissive | # -*- coding: utf-8 -*-
'''
Generate roster data, this data is used by non-minion devices which need to be
hit from the master rather than acting as an independent entity. This covers
hitting minions without zeromq in place via an ssh agent, and connecting to
systems that cannot or should not host a minion agent.
'''
f... |
0476951b5c77b67c1df5c5e69aec8b7d780c507c | 39d81d5321da1608ac34c34f7cf0e4e288d1fdf5 | Chernidiovsky/geocoder | /crawlGeoCodes/getDict.py | Python | py | 2,115 | no_license | # -*- coding: utf-8 -*-
import pandas as pd
# 根据geo_code.csv更新cityDic、cityRevDic
def updateCityDict():
df = pd.read_csv("geo_code.csv")
cityAndCodes = df[["city", "city_code"]].drop_duplicates().values.tolist()
cityAndCodes = sorted(cityAndCodes, key=lambda r: r[1])
print("cityDic = {")
for row ... |
0ed760a9207b2a771df85145ce3f4fdb09ee644c | e1e29bda57a49558e5b8ac020297de9248a98607 | CherginetsDA/camcalib | /test/test_sd_cam.py | Python | py | 3,067 | no_license | #!/usr/bin/env python
import argparse
import cv2
import numpy as np
import json
parser = argparse.ArgumentParser(prog="Data creater")
parser.add_argument('--version', action='version', version='%(prog)s 1.1')
parser.add_argument('-c','--conf', nargs="?", help="Config name and path to save params")
args = parser.parse... |
e5a8975156e431452bef5869f4c00ef30ad4b1f8 | 9d9b1015027ef8fbbe6f71d140b2b0de0295854e | malipalema/python-journey | /login.py | Python | py | 6,507 | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 1 13:41:03 2019
@author: Pale
"""
from tkinter import*
import tkinter.messagebox as tk
from tkinter import ttk
import sys,random
import time
import datetime
root=None
def main():
global root
root=Tk()
app=Login(root)
class Login:
de... |
5987ff7e9d8b08bbbb4aa2c8920303bebff52e22 | e156fbb71afca2f1a6289656befd0fdf21f46341 | mbunse/botui_demo | /backend/actions.py | Python | py | 1,837 | no_license | import re
from rasa_sdk import Tracker, FormValidationAction
class ValidateAuthenticateForm(FormValidationAction):
# pattern for uncode word characters except numbers
regex_name = r'[^\W\d]{2,}(\s[^\W\d]{2,}){0,2}'
regex_contract_no = r'[0-9]{10}'
regex_birthday = r'\d\d\d\d-\d\d-\d\d'
max_al... |
b0156f7bc19281cc0d6b0f46421cea06eeaa9bad | d5e669a1687412e98a4ab3eca7e9892e5aff9857 | RugnarLodbrok/drafts | /src/tasks/jump_game2.py | Python | py | 1,171 | no_license | """
https://leetcode.com/problems/jump-game-ii/
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Your goal is to reach the last index in the minimum number of jumps.
Example... |
e9acb620ff777ec5988e593b3bc702ac4bff125e | f3b9865869d85177ed8e60b8be4d923b89338f36 | sstults/rally | /tests/driver/driver_test.py | Python | py | 23,280 | permissive | import unittest.mock as mock
from unittest import TestCase
from esrally import metrics, track
from esrally.driver import driver
from esrally.track import params
from esrally.utils import io
class DriverTestParamSource:
def __init__(self, indices=None, params=None):
if params is None:
params =... |
e5a42e7abc486b091a55377120ee2b26b55f0ff2 | 91868455cb364fa563d381335b3683dcba402640 | COdingaorg/Rudimental_blog | /app/__init__.py | Python | py | 1,043 | permissive | from flask import Flask
from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy
from config import config_options
from flask_uploads import configure_uploads, UploadSet, IMAGES
from flask_login import LoginManager
from flask_wtf import CsrfProtect
from flask_mail import Mail
bootstrap = Bootstra... |
602edcd9ffa3055806c878c8685652ef1915822a | 49379a4c66c8d312daa0c46d27e245dd349492df | sampada22/nepal-company-registrar | /nepali_company_registrar/models.py | Python | py | 1,257 | permissive | from nepali_company_registrar.datasets import company_type_conversion, share_holder_conversion
class CompanyType:
def __init__(self, company_type, share_holder=None):
self.share_holder = share_holder
self.type = company_type
class Company:
"""
Model describing a Company
"""
def _... |
ce9bf83e07d61ded0e2ce60cafdd9c5262972db3 | dcdcec1ac1aa1607212f22ffe782d358eef002a4 | baru64/p4app | /docker/scripts/send.py | Python | py | 3,346 | permissive | #!/usr/bin/python
# Copyright 2013-present Barefoot Networks, Inc.
#
# 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 ap... |
3bb8362d7793448a1d185db3859cd81d05dc3620 | ce6ae947ef821731a34be73ff4821c2fe9ca3764 | lyz05/Sources | /北理珠/python/BTC/index.py | Python | py | 2,242 | no_license | # -*- coding: utf-8 -*-
import json
import time
import requests
import matplotlib.pyplot as plt
import pandas as pd
def get_response(url, payload):
response = requests.get(url, params=payload)
response.encoding = 'utf-8'
return response.text
def serverchan(text, desp):
SCKEY = 'SCU99687T71640fcac167... |
630848f8e22ad0a47fac56686164d8d9a700a903 | e23fb665fb36fa365396b58911dd825c7d3bad3c | jgehrcke/covid-19-analysis | /process.py | Python | py | 11,903 | permissive | #!/usr/bin/env python
#
# MIT License
# Copyright (c) 2020 Dr. Jan-Philip Gehrcke
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the right... |
9b06a548cae9744db51a5cc57c3986d29ec49aee | 772071aff3fb16f55e8c430a6a59790c7f622bf1 | jmohr/conrad | /conrad/test/units/adapter/test_odbc_adapter.py | Python | py | 359 | no_license | from conrad.adapter import ODBC
from conrad.test.units.adapter import GenericAdapter
from conrad.test import resource, create_test_database
class TestODBCAdapter(GenericAdapter):
def setup(self):
self.test_db_path = create_test_database()
self.adapter = ODBC('DRIVER={{SQLite3}};DATABASE={}'.forma... |
21dab4849c1458353cbadfd8430a77a526f009e2 | 494b2a34711d7211239c931bd2556d5aac98c199 | matijaSos/tiny-binner | /binning/LCABinner.py | Python | py | 1,479 | no_license | from testing.solution import Solution
from data.containers.read import ReadContainer
from ncbi.taxonomy.tree import TaxTree
class LCABinner(object):
''' Lowest common ancestor implentation of binner.
Each read is assigned to single taxon in taxonomy tree as the LCA
of all its alignments.
'''
def ... |
d39a79b9223635346447ea07abe1781ebf179eca | 6ef6a7e3b2326839f3bd7a29b84d95af3e4fe48c | danieljdenman/mouse_tunnel | /mouse_tunnel_auto_CUtest.py | Python | py | 27,239 | no_license | from direct.showbase.ShowBase import ShowBase
from direct.task import Task
# from direct.gui.OnscreenText import OnscreenText
# from direct.showbase.DirectObject import DirectObject
from direct.interval.MetaInterval import Sequence
from direct.interval.LerpInterval import LerpFunc
from direct.interval.FunctionInterval ... |
1c75ff839f210ea3293b7d4d4f38bfdc394c445f | 4e88a6b5427c98e1c9231b12602639d6cd209722 | MohammadSaadHaroon/bestfit | /venv/Scripts/pip-script.py | Python | py | 415 | no_license | #!C:\Users\aveen\PycharmProjects\DjangoMLAPI\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==19.0.3','console_scripts','pip'
__requires__ = 'pip==19.0.3'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.ar... |
beee41e1357dfd467cdcf8286ea4aaf076f03699 | 5d61cbecfa49e015f35fb37130e345d47696c335 | tursunbek/gameingame | /test1.py | Python | py | 292 | no_license | # name=input("введите имя:")
# print(name)
# num1=int(input('введите число'))
# num2=int(input('введите второе число'))
# print(num1/num2)
# num1="42"
# print(type(num1))
# s1="Besh.Besh"
# s2='TTTT'
# print(s1[::-1])
s1='john'
s2='lenno'
print(s1+s2) |
59b193b9ebcb536302c970ca59a2a57f25f1a9b5 | 897e34ef575a7305fb56f7675fb2b54e6d709427 | ardhanii/covid19-sir | /covsirphy/phase/phase_unit.py | Python | py | 18,552 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
from covsirphy.util.error import UnExecutedError, deprecate
from covsirphy.util.evaluator import Evaluator
from covsirphy.util.term import Term
from covsirphy.ode.mbase import ModelBase
from covsirphy.simulation.estimator import Estimator
from covsirphy... |
cd465ac493cdb2f3b72f34e0b372e82d41b2b1b6 | 9801f1ca53dbc5dccd695ed0da0ff34b1f78194e | deshiyan1010/Face-Recognition-Img-Vid-OnScreen | /face_video.py | Python | py | 4,218 | no_license | from facenet_pytorch import MTCNN, InceptionResnetV1
import math
import cv2
import numpy
from PIL import Image
import datetime
import torch
import os
import pandas as pd
from tkinter import *
from PIL import ImageTk, Image
from copy import deepcopy
def init_dict():
print("Initializing")
#test_data_dir = '/media'
... |
7393c1a104c9e171a72d73b4e6ebb81904355f32 | 731cef275d7ddace4c0ce7572ec570146f79d65b | sbmalik/stay_distanced_app | /StayDistancedApp/settings.py | Python | py | 3,337 | no_license | """
Django settings for StayDistancedApp project.
Generated by 'django-admin startproject' using Django 3.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/... |
e04961ce24d50b74dfb0e0d2f6bd1c52114d1df6 | 1c52ed24efa5c6405439744cf9929d8c88320194 | NLP-CISUC/muahah | /agents/externalAgents/OrAgent/noun_chunks_en.py | Python | py | 1,955 | no_license | import spacy
import string
nlp = spacy.load("en_core_web_sm")
def noun_chunks(obj):
"""
Detect base noun phrases from a dependency parse. Works on both Doc and Span.
"""
labels = [
"nsubj",
"dobj",
"nsubjpass",
"pcomp",
"pobj",
"dative",
"appos",
... |
a3d334e25725e2f957bec251958a4f69e3bd77fe | 597854b5adc2526d80aca766e8e8533153ffe443 | bubu42/Multi_agent_system | /venv/lib/python3.7/site-packages/pydcop/algorithms/mgm2.py | Python | py | 38,266 | no_license | # BSD-3-Clause License
#
# Copyright 2017 Orange
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the followi... |
c0cd2e8ccfe8f26b89d154452f0551b46bbc29fb | ab9c71dd9f0d4cc161d2a001382e35c0975a9166 | djunior/projetointegrado | /python/graphic.py | Python | py | 1,967 | no_license | import numpy as np
import math
import cv2
import cv
def create(array,width = 500,height = 300):
img = np.zeros((height,width,3),np.uint8)
fontFace = cv.CV_FONT_HERSHEY_SIMPLEX
fontSize = 0.6
fontColor = (255,255,255)
workWidth = int(width*0.8)
workHeight = int(height*0.8)
startX = int(width*0.1)
startY =... |
ef9e39d57b092f2cb6d30528893972e16f3c9473 | 376f299ed2089b58c0cfc4a03e09ab4efbe87e47 | austinmw/Introduction-to-Time-Series-Forecasting-with-Python | /chapter_30/models_plot_residuals_acf.py | Python | py | 1,081 | no_license | # ACF and PACF plots of forecast residual errors
from pandas import Series
from pandas import DataFrame
from sklearn.metrics import mean_squared_error
from statsmodels.tsa.arima_model import ARIMA
from statsmodels.graphics.tsaplots import plot_acf
from statsmodels.graphics.tsaplots import plot_pacf
from math import sqr... |
1ff2ec45d06e2ee3d6ef06c553ce96e29b76daaf | 9d1cd578994c7256627de486ea28df492a1515f0 | pramodsu/ILA-Tools | /examples/ptxILA/data_race/direct_nd/ptxILAdirect_nd_detail.py | Python | py | 25,602 | permissive | import ila
import time
import pickle
import Instruction_Format
import re
ila.setloglevel(3, '')
ila.enablelog('BMCResult')
ptx_declaration_obj = open('ptx_declaration_file', 'r')
ptx_declaration = pickle.load(ptx_declaration_obj)
program_obj = open('ptx_add_neighbor', 'r')
program = pickle.load(program_obj)
instruction... |
8291f95b6260c57a5535341d46e7099e5d89cccb | 22074c4da3bb6e541cc4b9d90a9d4747cf379cf8 | stromatolith/peabox | /peabox/peabox_testfuncs.py | Python | py | 12,503 | no_license | #!python
"""
peabox - python evolutionary algorithm toolbox
by Markus Stokmaier, IKET, KIT, Karlsruhe, August 2012
This file hosts some test functions.
"""
import numpy as np
import numpy.random as npr
from numpy import sqrt, pi, sin, cos, exp, log, ceil, where
from numpy import array, arange, asfarray, linspace, zer... |
bff8c0060502c04f334752e38058b1eb5c3d75fe | a8ab094f868619d2cef200a96ca210046ef0bcf8 | IrinaWPB/commerce | /auctions/migrations/0001_initial.py | Python | py | 5,666 | no_license | # Generated by Django 3.1.7 on 2021-04-03 02:05
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
... |
7c3e2bef9b6e146cdc1d2d8626ee35a1e1b0c041 | b2742275ef40abb8a3dab44cd398a875fcdc3083 | Virtlink/ccbench-chocopy | /cases/pa3/benchmarks/exp-89.py | Python | py | 329 | no_license | # Compute x**y
def exp(x: int, y: int) -> int:
a: int = 0
def f(i: int) -> int:
nonlocal a
def geta() -> int:
return a
if i <= 0:
return geta()
else:
a = a * $ID
return f(i-1)
a = 1
return f(y)
# Input parameter
n:int = 42
# Run [0, n]
i:int = 0
# Crunch
while i <= n:
print(exp(2, i % 31))
... |
ae38593b13270d2f69f4e689d2e34336a23b11ef | d8659040e93d19a2134e59afaef6c248ef734747 | yuhaozhang/ebc | /clusters-single.py | Python | py | 2,881 | no_license | import sys
from numpy import mean, std
from ebc import EBC
from matrix import SparseMatrix
def compareRandom(num_trials, tensor_dimensions, matrix_data, cluster_dimensions,
maxit_ebc, jitter_max_ebc, objective_tolerance):
deltas = []
iterations_M = []
iterations_Mr = []
noconverge_... |
c9fe4d8b6f3d09855e8afe50456bb88af302f942 | 67bd5ae63a38552eb092065bea310d1f741cd5da | JaysesS/ctf_writeups | /pwn/cockiejar/solve.py | Python | py | 271 | no_license | from pwn import *
overflow = b"a"
include = b'1'
for i in range(60,257):
con = remote('shell.actf.co',18100)
print('Try: {}'.format(i))
con.sendline(overflow * i + include)
res = con.recv().decode()
if 'actf' in res:
print(res)
break |
0f1020ac99b7ca9633450ce662efa56e17bcc361 | c02ac2d081c526c2c0d218ab85c181e58ad5b3e7 | seukjung/sentry-8.15.0 | /tests/sentry/models/test_organization.py | Python | py | 5,194 | permissive | from __future__ import absolute_import
from sentry.models import (
Commit, File, OrganizationMember, OrganizationMemberTeam,
Project, Release, ReleaseCommit, ReleaseEnvironment,
ReleaseFile, Team
)
from sentry.testutils import TestCase
class OrganizationTest(TestCase):
def test_merge_to(self):
... |
3cb8a4b4ee8c021a0fe6dd7a3860634e7a16e4b3 | 716d07605fbdcbbd40f29d96210e274af99db3dc | robertshin/OptioPay-ERP | /env/lib/python2.7/site-packages/dropbox/stone_validators.py | Python | py | 20,892 | no_license | """
Defines classes to represent each Stone type in Python. These classes should
be used to validate Python objects and normalize them for a given type.
The data types defined here should not be specific to an RPC or serialization
format.
This module should be dropped into a project that requires the use of Stone. In... |
028c0080bc050c865cf31504f4acbc2b7d22329e | 4f643be94a7ae136a13b6cdb2418f6e1ac0742dd | kolefrazier/PHYS2300-Assignments | /Assignments/Assignment 3/Exercise 3.6.py | Python | py | 2,904 | no_license | #--------------------------------------------------------------------------------
# G e n e r a l I n f o r m a t i o n
#--------------------------------------------------------------------------------
# Name: Exercise 3.6 - Feigenbaum Plot
#
# Usage: Graph the Feigenbaum plot for a small range of numbers.
#
# Descript... |
569d0a1e60264e967ccf54e501c3174016389560 | 0107ca2a986b430f1286a112394fe5ead60aca6c | luungoc2005/ParlAI | /parlai/core/teachers.py | Python | py | 85,030 | permissive | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
This module provides a set of teachers that deal with dialog.
``FixedDialogTeacher(Teacher)``
Base class for... |
e49c1154245307b69f07baa17160c2a810cac3b8 | 3dd24b2f414bb628eb999d8025d5f7a3145d5fff | blackcatkiller/django-getting-start | /polls/views.py | Python | py | 1,637 | no_license |
from django.http import HttpResponseRedirect
from .models import Question, Choice
from django.shortcuts import render
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.views import generic
from django.utils import timezone
# Create your views here.
class IndexView(generic.Lis... |
862aeba65f6e8b6639ea5cc2f622a73d3b59fb70 | 189804ed0406302d19e222a44e1adee96c73516a | PhillySchoolofAI/cython | /Cython/Compiler/ParseTreeTransforms.py | Python | py | 139,292 | permissive | from __future__ import absolute_import
import cython
cython.declare(PyrexTypes=object, Naming=object, ExprNodes=object, Nodes=object,
Options=object, UtilNodes=object, LetNode=object,
LetRefNode=object, TreeFragment=object, EncodedString=object,
error=object, warning=object... |
e2e207fbf086261f003e504ddf0e2bc94a246e4a | f5b66787598ab2903f30b65253cff9c2edc2d65a | corneliustbadger/probable-octo-tribble | /boards/tests.py | Python | py | 4,575 | no_license | from django.urls import reverse
from django.urls import resolve
from django.test import TestCase
from .views import home, board_topics, new_topic
from .models import Board
from django.contrib.auth.models import User
from .views import new_topic
from .models import Board, Topic, Post
class HomeTests(TestCase):
def... |
851c75f7b8c12c950ac0f813e70a7dcd7a5b6132 | 42e9af2d74fc17db4a41e695e6de05881aa2ce15 | Entropite/Advent-Of-Code-2020 | /Advent of Code/7/main.py | Python | py | 1,672 | permissive | data = open("input.txt", "r")
bagData = {}
def initializeBags(bagDescriptions):
removeSuffix = lambda str, suff: str[:-1] if str.endswith(suff) else str
getBagQuantity = lambda str: int(str.split(" ")[0]) if str[0] != "n" else 0 # distinguish between regular bag quantities and "no other bag"
for ba... |
fbba6e94f6565d2dec2541d28886f9bbe8d36f3b | 87940b40c87adcb61c1d24b4ae045c64c04581d5 | HuaMuLanChina/Piano-Fingering-Generators | /HMM Training/assign.py | Python | py | 4,199 | no_license | import settings
import NNrules
import ChordsOriginal
def up(list1,list2,f):
a = len(list1) #list1增序列
poss = [] #poss = possibilities 可用指法的情况
for i in range(a - 1):
n = len(poss)
if i == 0: #现在讨论的是第一个元素
temp = settings.intervalbook[list1[i+1] - list1[i]][:] #查阅音程对应的可用指法, temp包... |
58ff1e01599078e6bfb8c09831b0265e6a756c7b | 2182e7bd9def5914f769b32f54b05a55792d2d4d | madcowfred/evething | /thing/tasks/contracts.py | Python | py | 13,495 | permissive | # ------------------------------------------------------------------------------
# Copyright (c) 2010-2013, EVEthing team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# Redistributions of... |
5f7a8d299e01e186a5198de137e7014ecff41ee5 | 7da7707bc7578bb0f19f3a5ca3a3544de371585e | yesxiaoyu/texar-pytorch | /texar/torch/modules/pretrained/pretrained_base.py | Python | py | 9,411 | permissive | # Copyright 2019 The Texar Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
0dd5663aef40bd4c7736dd6ea893528f185fb1c2 | 1b2852f09ff0563ef9dd1deca587304eea402b5f | RaviTezu/python-scripts | /generator.py | Python | py | 1,481 | permissive | #!/usr/bin/python
#Write a generator, genPrimes, that returns the sequence of prime numbers on successive calls to its next() method: 2, 3, 5, 7, 11, ...
#GENERATOR:
# A generator seperates the concept of computing a very long sequence of objects, from the actual process of computing them explicitly.
# Generators allo... |
489bab31592329f918c68bedf7c4c0e81f092c5a | 468151d69a4a6ab0027139d4880223a2e554dfeb | ryanam26/DonkiesAPI | /donkies/web/models/emailer.py | Python | py | 3,800 | no_license | import copy
import datetime
from django.db import models
from django.contrib import admin
from django.conf import settings
from django.apps import apps
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.template import Context
class EmailerManager(mo... |
3a1b732de94ebd92dc1346c4606c1d6cebfbafd2 | 30ed102d96b34ab0b153cba0cb9faa50923b197e | pwnslinger/vmcloak | /vmcloak/win7.py | Python | py | 706 | no_license | # Copyright (C) 2014-2016 Jurriaan Bremer.
# This file is part of VMCloak - http://www.vmcloak.org/.
# See the file 'docs/LICENSE.txt' for copying permission.
from vmcloak.abstract import WindowsAutounattended
class Windows7(WindowsAutounattended):
name = "win7"
service_pack = 2
interface = "Local Area Co... |
d5524d403adc4890e8ffa0e1da5be1d53cf21208 | cdda84a0b10648af2c776ca2ec45b77a27b8599a | boredomkills92/test_sample | /dweetfeed/views.py | Python | py | 1,249 | no_license | """
This class provide readonly api for feed for users
"""
from django.shortcuts import render
from django.shortcuts import get_object_or_404
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import viewsets
from rest_framework import mixins
from rest_framework.response import Response
from res... |
179a687a372a808ac2271d4b39a8d2d7a7c454f3 | 105d5081a226b199ee02d43bb9c5f2a935d159db | jimbuho/django-brain | /brainutils/templatetags/butils.py | Python | py | 1,200 | permissive | # -*- coding: utf-8 -*-
"""
.. module:: dbu-maintags
:platform: Unix, Windows
:synopsis: Tags del modulo DBU
.. moduleauthor:: Diego Gonzalez <dgonzalez.jim@gmail.com>
"""
from django import template
from django.utils.safestring import mark_safe
from brainutils import messages, configuration
register = templa... |
eb0c87db888b22065b4de78d18ad3b95fb38f8fb | 114ab2f2044a95a839a0306bbad960a914228eb3 | freedomandfinally/Sleep_Apnea_Detection | /Dev_ex/Pi_startup/RSA/rsa_ex2.py | Python | py | 1,855 | no_license | import Crypto
from Crypto.PublicKey import RSA
from Crypto import Random
from Crypto.Hash import MD5
# Use a larger key length in practice...
KEY_LENGTH = 1024 # Key size (in bits)
random_gen = Random.new().read
# Generate RSA private/public key pairs for both parties...
keypair_snowden = RSA.generate(KEY_LENGTH, ra... |
0ca7d35af94ff420c2e12eac815d04735f34e031 | 8ffec0079a2ac0c3a4a48f0d68a2735ae6d26845 | radical-collaboration/DeepDriveMD | /experiments/mpipes/mtasks.py | Python | py | 3,268 | no_license | from radical import pilot as rp, utils as ru
def prepare_pilot(rd, uid=None):
session = rp.Session(uid=uid)
pmgr = rp.PilotManager(session=session)
umgr = rp.UnitManager(session=session)
pilot = pmgr.submit_pilots(
rp.ComputePilotDescription(rd))
umgr.add_pilots(pilot)
return ses... |
6000f2d2aff253bd17330c5a64f47c99d8d07368 | ac921ca434befaed1395c33fb53469271f71c458 | dputtick/housemate-hunter | /housematehunter.py | Python | py | 6,663 | no_license | #!/usr/bin/env python
"""
By Marielle Foster, July 2016
Inspiration from Paul Fenwick
If you want to use it remotely, you need to have a device on the network
- i.e. a raspberry pi or something similar
"""
import os
import subprocess
import re
import argparse
from multiprocessing.dummy import Pool as ThreadPool
fr... |
226d68ba4f7be8f0a36ae4479c57df3eedd1a3f5 | a1828aa83aa94468af989df501e99869127ba4fc | lianmc123/Dockerfiles | /biscrapy/biscrapy/utils/bloom_filter.py | Python | py | 2,165 | no_license | import redis
from hashlib import md5
class SimpleHash(object):
def __init__(self, cap, seed):
self.cap = cap
self.seed = seed
def hash(self, value):
ret = 0
for i in range(len(value)):
ret += self.seed * ret + ord(value[i])
return (self.cap - 1) & ret
cla... |
6ceba388e1450dcb86e7745468b85de6a9a84119 | 43f589ca6df171da7a3d9553539af86dcfcef8f3 | kiran-padwal-connecsi/data-science-project-webscrapping | /scheduler_coin_market_cap_supply.py | Python | py | 1,319 | no_license | import schedule #pip install schedule
import time
from controller.CoinmarketcapController import CoinmarketcapController
def getMinuteData(url):
print(url)
if url == 'coinmarketcap.com':
conObj = CoinmarketcapController()
conObj.get_minute_data()
else:
print('not matched url')
get... |
b0c28d5b9b9ec0cf0875e18b19040d0f6da40b85 | 08a903b77ac814ff332faa070e87c213e6b142d6 | shm2/kafka-utils | /kafka_utils/kafka_consumer_manager/commands/offset_save.py | Python | py | 5,473 | permissive | # -*- coding: utf-8 -*-
# Copyright 2016 Yelp Inc.
#
# 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 ... |
d2db2c0608a6ad6ca1f9c423c55ec4aeffef3939 | 1f5301bd990b56139c0972bec7a8a55f35d734d1 | mohitsharma2/Python | /Book_program/divisor.py | Python | py | 1,068 | no_license | #program to find the multiles of a number(divisor) out of given five number.
print("Enter the five number below")
num1=float(input("Enter first number:"))
num2=float(input("Enter second number:"))
num3=float(input("Enter third number:"))
num4=float(input("Enter fourth number:"))
num5=float(input("Enter fifth... |
6b7db0d43aa5be2cb127335ca4a28dd34d86f9c2 | f43c06bb6f4f56e3207f53c87f37808050b241aa | jphalip/event-registry-python | /EventRegistry/QueryArticle.py | Python | py | 5,314 | permissive | from eventregistry.Base import *
from eventregistry.ReturnInfo import *
class QueryArticle(Query):
def __init__(self,
articleUriOrUriList):
"""
Class for obtaining available info for one or more articles in the Event Registry
@param articleUriOrUriList: a single article u... |
cc5910cc976938922d779ae606bd321e356f1f3c | 79930b34bd5bde435d917de04271bfc6684268f6 | home-assistant-libs/pytradfri | /tests/test_socket.py | Python | py | 275 | permissive | """Test Socket."""
from pytradfri.device import Device
from .devices import OUTLET
def socket(raw):
"""Return socket."""
return Device(raw).socket_control.sockets[0]
def test_socket():
"""Test socket."""
plug = socket(OUTLET)
assert plug.state == 0
|
24c53b2d12cf6cf062dfd8dd73421cec3b1f13dd | 7432bf1b502d1747497750e4ce25c6cbe1fb6d8c | elasmd/channels | /api/package/migrations/0001_initial.py | Python | py | 797 | no_license | # Generated by Django 2.2.3 on 2019-07-29 13:18
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('channel', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='P... |
ddcc496f0b8127f8590ffe7cd0feadb6423e723d | 195314b9e1c67b7e25699535efbe49e3b86a6998 | ChetnaKumbhare/Product_Hunt | /products/views.py | Python | py | 1,928 | no_license | from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from .models import Product
from django.utils import timezone
# Create your views here.
def home(request):
products = Product.objects
return render(request, 'products/home.html', {'products... |
9745562bde07dd5af835291d01fd9ee3fea96bf3 | 5689edc163d2651486de72fa1533c6f7a1ef1e68 | constable-ldp/day_2_exercises | /exercise_a_stops.py | Python | py | 902 | no_license | stops = [ "Croy", "Cumbernauld", "Falkirk High", "Linlithgow", "Livingston", "Haymarket" ]
#1. Add "Edinburgh Waverley" to the end of the list
stops.append('Edinburgh Waverley')
#2. Add "Glasgow Queen St" to the start of the list
stops.insert(0, 'Glasgow Queen St')
#3. Add "Polmont" at the appropriate point (between... |
610647fbf3bb9e1ff75f9b0b7f185110d57b84bd | 42cafe40d47ceab2006b2e4451bea861522598f5 | Pranavarya1601/DelhiShades | /HomePage/migrations/0019_auto_20200330_1117.py | Python | py | 467 | no_license | # Generated by Django 3.0.4 on 2020-03-30 05:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('HomePage', '0018_auto_20200329_1939'),
]
operations = [
migrations.RemoveField(
model_name='userprofileinfo',
name='user_fir... |
0f0aaa0f850b2b3ffe59660103dc97026fc1997a | 7f8cc024965e950bc3442a52985c721deedd5daf | deathvn/Outline_Colorization | /utils.py | Python | py | 3,848 | no_license | import tensorflow as tf
import numpy as np
import cv2
class batch_norm(object):
# h1 = lrelu(tf.contrib.layers.batch_norm(conv2d(h0, self.df_dim*2, name='d_h1_conv'),decay=0.9,updates_collections=None,epsilon=0.00001,scale=True,scope="d_h1_conv"))
def __init__(self, epsilon=1e-5, momentum = 0.9, name="... |
5ba1a7af5e808abf3d5e146e43abf4542135ca70 | 40a4ab00433e511769c2eeb3f9d7201a032cbca3 | boss13521/scrapy | /douban/douban/middlewares.py | Python | py | 998 | no_license | # -*- coding: utf-8 -*-
import base64
import random
from settings import USER_AGENTS
from settings import PROXYS
class RandomUserAgent(object):
def process_request(self,request,spider):
#随机选择useragent
useragent = random.choice(USER_AGENTS)
#print useragent
#修改useragent
reque... |
1d6bea001462732895a82dc28b6c915c91a1207e | cc655c4b7e0ba480959a7a7c38940d6c588b25f4 | chairmanlee8/django-flexible-auth | /flexible_auth/contrib/_openid.py | Python | py | 4,466 | no_license | # Here lies some OpenID models necessary for session storage (during authentication, which spans several requests)
# Eventually we'll put an actual OpenID superclass or mixin here, to support a variety of services.
# Code from Rok: http://stackoverflow.com/questions/4307677/django-google-federated-login
from django.d... |
f8beab27bc6fee11015b5106c57fef075ac6786e | c9d38a66defdebc9bc376c67a67a25225138d2eb | ag-castro/api-tour-drf | /manage.py | Python | py | 540 | no_license | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api_tour.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are... |
3e85084e1020d2e933b00de722d96a007e5e1b2d | 442c844694bfafc06a2cbe42484684a78a79aa4f | EricWiener/universal-devkit | /setup.py | Python | py | 714 | permissive | """
Setup file for universal-devkit.
Use setup.cfg to configure your project.
This file was generated with PyScaffold 4.0rc2.
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: https://pyscaffold.org/
"""
from setuptools import setup
if __name__ == "__main__"... |
abecbeb0c7f336f32dce7d71c29c7fa71001ff61 | cf06a854c431eab1728848fd974ed0b32e3ff662 | shashank3959/HackerRank_Python | /Python/Captains_Room.py | Python | py | 1,535 | no_license | # Mr. Anant Asankhya is the manager at the INFINITE hotel. The hotel has an infinite amount of rooms.
#
# One fine day, a finite number of tourists come to stay at the hotel.
# The tourists consist of:
# → A Captain.
# → An unknown group of families consisting of members per group where ≠ .
#
# The Captain was given ... |
0d680fedafb97593197704244912a3b3933b6fc2 | fac16747835fcfe7c8d9315526ca90a4b546a6cd | tenebrion/learningpython | /pe03.py | Python | py | 388 | no_license | """
Largest Prime Factor
What is the largest prime factor of the number 600851475143?
"""
def find_prime():
"""
This is problem 3 on Project Euler
:return:
"""
large_prime = 600851475143
i = 2
while i * i < large_prime:
while large_prime % i == 0:
large_prime = large_p... |
751e6001cfff792bff4b9721af9339a4ae504c61 | 4a94f4523c0329ab0a69cd9fe7a501df41e08e6c | wexpect/udacity_self_driving_car_nanodegree | /2_computer_vision/4_from_linear_regression_to_feedforward_neural_networks/13_exercise_stochastic_gradient_descent/training.py | Python | py | 2,922 | no_license | import tensorflow as tf
from dataset import get_datasets
from logistic import softmax, cross_entropy, accuracy
def get_module_logger(mod_name):
logger = logging.getLogger(mod_name)
handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s %(levelname)-8s %(message)s')
handler.setFo... |
cfb580f77e551b8781386279f7428fa5732af794 | 305fa7e3bd3bc5868eacaf858fbefdfac6605241 | sergio-kzn/derevo116.ru | /Cart/models.py | Python | py | 6,544 | no_license | from django.db import models
from Product.models import Product, Color
class Country(models.Model):
"""Страны для доставки"""
country_name = models.CharField(verbose_name='Страна', max_length=100)
country_default = models.BooleanField('По умолчанию', default=False)
country_order = models.IntegerField... |
20a0ff2119fa01f12aa85613b57b431f48cbef62 | c2fb49e7aaf2065509da7a9ddbd8d03d1be5c81e | stolksdorf/BGSAWorkshop | /Python/ex4.py | Python | py | 1,533 | no_license | import sys
import csv
import re
if len(sys.argv) < 2:
print "Must provide an input file name"
sys.exit()
if len(sys.argv) < 3:
print "Must provide an output file name"
sys.exit()
inputFilename = sys.argv[1]
outputFilename = sys.argv[2]
csvWriter = csv.writer(open(outputFilename, 'wb'))
dataset = csv.reader(open... |
0e9adc25a05412d5f5636804d5695065a2098fc4 | ad399cc1b698d783bbf154422c24b104b9959a7f | BerilBBJ/scraperwiki-scraper-vault | /Users/T/tlevine/south_africa_geocoding_validation.py | Python | py | 12,878 | no_license | from scraperwiki.sqlite import attach, select, get_var, save_var, save, execute, commit, show_tables
from urllib2 import urlopen
from urllib import urlencode
from json import loads, dumps
from time import sleep
from unidecode import unidecode
from geopy import geocoders, distance
attach("capitec_bank")
COLUMNS = {
... |
e017ac68a7e2a8ae18dbebbb537ae25e7556bf96 | 2a280794ccc8cff891f7fd590040ff34d23e47a6 | 369geofreeman/MACHINE-LEARNING-FOR-TRADING | /part1/01-02-Working_with_multiple_stocks/Plotting-multiple-stocks.py | Python | py | 1,422 | no_license | # Plotting multiple stocks
import os
import pandas as pd
import matplotlib as plt
def symbol_to_path(symbol, base_dir="data"):
"""Return CSV file path given ticker symbol."""
return os.path.join(base_dir, "{}.csv".format(str(symbol)))
def get_data(symbols, dates):
"""Read stock data (adjusted close) fo... |
d0a41af9d14d48d792c9afbf5764c63ccabcf37a | 195b5111756ee40c7cfc4e1d1c6be33273d4a202 | NWCalvank/react-python-starter | /server/manage.py | Python | py | 761 | permissive | import unittest
from flask.cli import FlaskGroup
from app import create_app, db
from app.api.models.foo import Foo
app = create_app()
cli = FlaskGroup(create_app=create_app)
@cli.command()
def recreate_db():
db.drop_all()
db.create_all()
db.session.commit()
@cli.command()
def create_db():
db.create_... |
9baeb348210cd00fb9e4834bbac57a32731afe8f | 7fa728aeca1832159befbe4c163d566a0b18bb72 | lDisciple/TensorSwarm | /tensorswarm/utils.py | Python | py | 3,636 | permissive | import tensorflow as tf
@tf.function
def init_particles(particles, dim, bounds, dtype=tf.float16):
x = tf.random.uniform([particles, dim], dtype=dtype,
minval=bounds[0], maxval=bounds[1])
v = tf.zeros([particles, dim], dtype=dtype)
return x, v
def init_predators(predators, dim, bounds, dtype=tf.f... |
9d72765a56a30b2cd096cc2eb3b7efcd4358c499 | 9b2c8b8ec6d02ade8c59c67be73ffaf5d0c00187 | pabloslash/MNIST_lowres | /my_helper_pytorch.py | Python | py | 13,187 | no_license | # Helper Functions
import numpy as np
from torch.autograd import Variable
import torch
import IPython as IP
###### Get Accuracy
def get_accuracy(dataloader, net, classes, use_cuda, cuda=0):
correct = 0
total = 0
for data in dataloader:
inputs, labels = data
if use_cuda:
inpu... |
d3c9c1d5be68c661bffe33323f3513836cfff886 | 1753a598ee3a5ef9d3fc1f06c7fd35c6d0686ff7 | jukemal/swms_backend | /scripts/generate_water_level_data.py | Python | py | 1,038 | no_license | from datetime import datetime
import random
from reservoirs.models import Reservoir
from water_level.models import WaterLevel
from month import Month
currentYear = datetime.now().year
currentMonth = datetime.now().month
START_YEAR = 2005
year_list = [y for y in range(START_YEAR, currentYear + 1)]
months_list = [m f... |
88a34a6e9c7b69814eaed8651fe15841ced9f26a | 6ec241740ffa50f33a2976399e382bebb69e01aa | nelsondaza/sndlatr | /gae/tests/__init__.py | Python | py | 3,680 | permissive | import os
import json
import os
from unittest import TestCase
from contextlib import contextmanager
import webapp2
from google.appengine.ext import testbed
import mock
import main
test_data_dir = os.path.join(os.path.dirname(__file__), 'data')
def fixture_file(filename):
""" Returns path of test data file """... |
abc50cff3b5f7cc14e20f7bc572157fb23a9c19b | ee1b3d9fcf1ea1d7c96f02c6e59c346b48e8d42a | nacho22martin/tesis | /eggs/zope.app.container-3.9.1-py2.7.egg/zope/app/container/browser/tests/test_view_permissions.py | Python | py | 3,999 | no_license | ##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... |
78755c2beb5b8610ce858d092b7a6bd9f3f7c18a | 14b598b96040c8796307201dc71c8ae6bb54403d | zzhengyang/exceptionDetection | /paraSearch.py | Python | py | 4,121 | no_license | # coding:utf8
import cv2
import numpy as np
import random
import imutils
import matplotlib.pyplot as plt
def randomColorGen():
""" Generate random color
Returns:
random color tuple, example: (0, 255, 145)
"""
return (random.randint(0, 255), random.randint(0, 255), random.randint(0, 25... |
7da1fba5299aaefb2ff22122ffa755037768dd78 | 78d578533531c8c80a48618f1db30eac8dd2c847 | Anitej/kairon | /augmentation/knowledge_graph/cli/utility.py | Python | py | 1,523 | permissive | import json
from typing import Dict
from urllib.parse import urljoin
import requests
from loguru import logger
class TrainingDataGeneratorUtil:
@staticmethod
def http_request(method: str, url: str, token: str, user: str, json_body: Dict = None):
headers = {'content-type': 'application/json', 'X-USER... |
6ce3db784c1fac468ac8f86172b09aedb6f697bb | 094ca2f59e3341bc2dd533f2b6b948443285b841 | Coul33t/texture-generation | /binary_texture/simulated_anneling.py | Python | py | 11,877 | no_license | import sys
import random as rn
from math import exp
from PIL import Image
import numpy as np
import pygame
import pandas as pd
import matplotlib.pyplot as plt
# TODO: use rect everywhere
# TODO: only recompute patterns from modified rect
class Rect:
def __init__(self, x, y, w, h):
self.x1 = x
se... |
4b697a980ad6a21e7bad9fea76d82c7e2105d8bd | 1f595e65af3859f997c3c5fa7ae3019d24cca68c | Yaser7440/cmdline_iptvplayer | /hosts/ourmatchnet.py | Python | py | 22,268 | no_license | # -*- coding: utf-8 -*-
###################################################
# LOCAL import
###################################################
from Plugins.Extensions.IPTVPlayer.dToolsSet.iptvplayerinit import TranslateTXT as _, SetIPTVPlayerLastHostError
from Plugins.Extensions.IPTVPlayer.components.ihost import CHost... |
5f0ada009086eb161c7a2ee9b40ba89609e01dcc | ed844bed6c9d4fc0cc0305707bf636b267cc5fce | deepyaman/kedro | /tests/framework/cli/test_jupyter.py | Python | py | 16,217 | permissive | import json
import shutil
from pathlib import Path
from tempfile import NamedTemporaryFile
import pytest
from click.testing import CliRunner
from jupyter_client.kernelspec import (
KernelSpecManager,
find_kernel_specs,
get_kernel_spec,
)
from kedro.framework.cli.jupyter import _create_kernel, _export_node... |
8c2b3ec25faa2420e7fd5b63eb5290de5d4604c2 | 0311ebe5492bbf54dd4666b32753df623bb0c044 | korobkioptom/3-3 | /botinok.py | Python | py | 1,155 | no_license | import requests
bot_token = '710715631:AAHvw3WnM4W_weBbZPDoZyxr_Srk3K8y1zM'
telegram = 'https://api.telegram.org/bot{}/'
def get_updates ():
res = requests.get(telegram.format(bot_token)+'getupdates')
#print (res.json())
return res.json()
#print (get_updates())
def last_messaga ():
updates = get_upda... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.