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 |
|---|---|---|---|---|---|---|---|---|
ad566d290afd5c1d9a754d41d5c634afdb12444c | 058457cc830c5da0fa738ec264aa7d5ed64a6b42 | christianbitter/elisa | /elisa_0_1_drawing_shapes.py | Python | py | 2,432 | permissive | # name: elisa_0_1_drawing_shapes.py
# auth: (c) 2020 christian bitter
# desc: Some simple pygame shape drawing and the first use of some linear algebra functions
import pygame as pg
from math import sin, cos, pi
from elisa import Vec2, Point2
C_BLACK = (0, 0, 0)
def draw(buffer):
"""draw a typical trigonemtric ... |
4b1c7ebe2277d4be6ac30f849795608725ddb611 | a46221bb4d820c94f28eeee5152a78714a453e9b | thonmaker/mollab | /mollab/core/forcefield.py | Python | py | 3,178 | permissive | # author: Roy Kid
# contact: lijichen365@126.com
# date: 2021-01-24
# version: 0.0.1
from mollab.core.potential import bond_potential_interface, angle_potential_interface, pair_potential_interface, dihedral_potential_interface, improper_potential_interface
class ForceField:
def __init__(self, world):
se... |
01791d96830a7029d6db166d17449e8fbc968b45 | 346c2303cca21427d0e2929809336346e3f37507 | Onebigbera/celery_task | /apps/books/migrations/0001_initial.py | Python | py | 3,974 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-09-27 08:25
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
depend... |
a5dbd7db3c7c5b888645af08f0a418a4f80f31a2 | 4b287c0684a398d5d715d8bcdddd2c9363d6c7d1 | iopsai/iops | /phase2_env/client_example/train.py | Python | py | 572 | no_license | import sys
import torch
import pandas as pd
import os
import dill
def main():
persist_path = sys.argv[1]
train_data_path = sys.argv[2]
df = pd.read_csv(train_data_path)
# test read train data file
kpi_ids = list(set(df["KPI ID"]))
print("kpi_id:", kpi_ids)
# test GPU operation
torch... |
26ecf3519d70226e9de315716c83ba8c1239d15b | 42824fd3787910134e669730cece09fa8abf4438 | BuntyBru/SudoPlacementGeeksForGeeks | /QueueUsingArray.py | Python | py | 271 | no_license | class Queue:
def __init__(self):
self.items=[]
def isEmpty(self):
return self.items == []
def enqueue(self):
self.items.insert(0,item)
def dequeue(self):
self.items.pop()
def size(self):
return len(self.item)
def __str__(self):
return str(self.items)
|
746f433786bd615f2c7ea38cd3a43aa840fa4e6b | 017bc62fc3991f9b5550d1c2ae26539ccba21cac | jmgao/bfg9000 | /bfg9000/tools/rm.py | Python | py | 496 | permissive | from itertools import chain
from . import tool
from .common import SimpleCommand
from ..iterutils import iterate
@tool('rm')
class Rm(SimpleCommand):
def __init__(self, env):
default = ['rm -f']
if env.host_platform.name == 'windows':
default.append('cmd /c del')
SimpleCommand... |
3fd69da0b4057e1fb1be04308e79543d1d0b7a28 | 8e9e48fef0c8e0d08bf76b929f076d3ccbd13e4a | tabatagloria/curso_video_Python | /Mundo_2-Estruturas_de_Controle/desafio_50.py | Python | py | 271 | no_license | #soma de números pares com for
soma = 0
cont = 0
for i in range(6):
n = (int(input('digite o {}º número: '.format(i+1))))
if n % 2 == 0:
soma += n
cont += 1
print('A quantidade de números pares foi {} e sua é: {}'.format(cont, soma))
|
e6bd5ca11a2131600907bcab86a3513e542880c0 | 2952ce1c5ae33c63ee3b91ce8e8012b45889622b | promil23/django-debug-toolbar-template-timings | /template_timings_panel/panels/TemplateTimings.py | Python | py | 8,982 | permissive | from debug_toolbar.panels import Panel
from django.conf import settings
from django.template import base as template_base
from django.template.base import Template
from django.template.loader_tags import BlockNode
from debug_toolbar.panels import sql
from django.core.exceptions import ImproperlyConfigured
import thread... |
2325a05838e5a4ef341a452c668340f284235219 | b3c97d0db6b3b333aba5dab0bf0de2ee792c6c4f | LeetCodeMio/LeetCodeProblems | /AcRate/127. 646. Maximum Length of Pair Chain .py | Python | py | 672 | no_license | # 先将pairs按second元素从小到大排序
# 首先 第一个pair使用pairs[0]肯定能构造出最优解
# 因为任给一个最优解 将它的第一个pair替换为pairs[0]仍然是最优解
# 将pairs[0]选为第一个pair后
# 在剩下的可合法链接的pairs中 使用second最小的一定能构造出最优解
# 因为假设选择了别的pair构造出了最优解
# 将它替换为second最小的pair仍然是最优解
from operator import itemgetter as ig
class Solution :
def findLongestChain(self, pairs) :
pairs.s... |
815790c1b3a6d790f51dcac198d70c43b0f4fde0 | 60385309926de473923f30a04b86246d696c90fd | snpushpi/CTCL-Solutions | /max_path_sum.py | Python | py | 745 | no_license | class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def max_sub_path(root):
if root is None:
return 0
l = max_sub_path(root.left)
r = max_sub_path(root.right)
max_path_through = max(root.data,max(l,r)+root.data,l+r+root.data)
... |
465f2fb2fd606aeaadafce25ee6934dc97ff1821 | 687e1fde108fe1d8d1106df4df9addbe5345ab86 | robertopauletto/PyMOTW-it_3.0 | /dumpscripts/threading_event.py | Python | py | 1,144 | no_license | # threading_event.py
import logging
import threading
import time
def wait_for_event(e):
"""Attende che l'evento sia impostato prima di fare qualsiasi cosa"""
logging.debug('wait_for_event in partenza')
event_is_set = e.wait()
logging.debug('evento impostato: %s', event_is_set)
def wait_for_event_ti... |
d860522d1dcee25a28a1ad42a308195068d11ee9 | d46d0ea4b0c9ea3d82a4b462fe22100c12ab8bfb | brett-smythe/interns | /interns/setup/interns_db_setup.py | Python | py | 283 | no_license | from interns.models import models, twitter_models
from interns.models.base import Base
from interns.clients.db_client import engine
from interns.utils import get_logger
logger = get_logger(__name__)
logger.info('Setting up database for interns')
Base.metadata.create_all(engine)
|
4a6e724bd0d46e68002efde71de5fe05532f9d12 | 9973a21a565e7c3f7e126bbec17ea628cf459c20 | Khushboo1192/BioInformatics | /TheGeneticCode/TheGeneticCode.py | Python | py | 1,301 | no_license | def computeGeneticCode(sampleDNA):
geneticCode=''
j=0;
temp=''
for c in sampleDNA :
if j != 3 :
temp+=c
j+=1;
else :
print temp;
print rna_table.__getitem__(temp)
geneticCode+=rna_table.__getitem__(temp)
temp=''
temp+=c
j... |
8af662268758c911b5a4f110ef17939e51b3bd38 | 9a4a027e18cc1b83b25c79bd359bd1a6474bdb9d | ddalma/Python-Practice | /vehicles.py | Python | py | 1,322 | no_license | class Automobile:
def __init__(self,make, model, mileage, price):
self.__make = make;
self.__model = model;
self.__mileage = mileage;
self.__price = price;
def set_make(self, make):
self.__make = make;
def set_model(self, model):
self.__model = model;
def set_mileage(self, mileage):
s... |
d75072e1d16dfe125d18ef9ee1a5e30af76ec8ca | be6f798f8d41bd3063f99d67c42a50fcb2bfbc78 | johnpaulkiser/cbTrades | /cbTrades/databus.py | Python | py | 1,865 | no_license | from cbpro import WebsocketClient
from selector import Selector
import time
import json
class ClientFeed(WebsocketClient):
def on_open(self):
self.url = "wss://ws-feed.pro.coinbase.com/"
# s = (profit in usd, bdi in usd, pair, ammount of crypto to trade)
self.s = Selector(0.05, 0.05, 'ETH-... |
dcead31b153329415776f400f0eb8eee7988302a | 0f0dce33155d3d3ecb9510ce98846beb439a96d4 | awslabs/amazon-documentdb-tools | /global-clusters-automation/test/test_failover_and_delete.py | Python | py | 369 | permissive | from failover_and_delete_lambda_function import lambda_handler
event = {
"global_cluster_id": "global-demos",
"secondary_cluster_arn": "arn:aws:rds:us-east-2:378282045186:cluster:cluster-5-165836",
"primary_cluster_cname": "primary.sample.com",
"hosted_zone_id": "Z00565841LXHQLXKDOHSB",
"is_delete_... |
980e883c95c8f4dd012c1844a1f9bd418768fb0f | c28ef30f6d2121db4facafc3285a7b54d666f8a5 | clefru/mypyaes | /tmath_tests.py | Python | py | 715 | no_license | from tmath import *
import unittest
class TmathTests(unittest.TestCase):
def test_self_inverse(self):
# Residue class 2 field
Z2 = Z(2)
# Polynomial over field Z2
POFZ2 = POF(Z2)
# Reduction polynomial in POFZ2 as defined by Page 36 of the Rijndael book. MAGIC
rp = L2POL([1, 1, 0, 1, 1, 0, ... |
f804833125a50d5b69d83e9697c9d90692e7ad1a | 04e3318e86d126865b25e1f4ee862a0a0f2039e3 | thundernova/spider | /test/国家煤矿安全局(符号 - - ).py | Python | py | 2,748 | no_license | #encoding=utf-8
import requests,re,bs4,time,sys,hashlib,uuid,time,json,base64,rsa,platform,datetime,os,urllib
UserAgent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36'
def get_time(format_date,time_pull = None):
if time_pull:
return int(tim... |
e9a870a6e5b06c0162e127c68fb2ebac9e3e2949 | 106065a0d21c692fe04b11dd43b81141586c145d | OliveiraClaudio/my-first-blog | /mysite/settings.py | Python | py | 3,210 | no_license | """
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 2.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# ... |
9b4ddc5879189cfff02762378a451457017ddff6 | 2c48b3392d71e4ab3771346071af7445d7697499 | fedorzaytsev06/FirstProject | /amount_bochek.py | Python | py | 257 | no_license | n = int(input())
if n <= 10 or n >= 20:
if (n % 10) == 0 or (5 <= (n % 10) <= 9):
print(str(n) + " bochek")
elif (n % 10) == 1:
print(str(n) + " bochka")
else:
print(str(n) + " bochki")
else:
print(str(n) + " bochek") |
1934eea8253b9bfa6d6a926d7a323783e0411cbe | de56780642d1cde99cd27633c01dc53171cb43b8 | yyztc/itop | /load_hypervisor.py | Python | py | 2,540 | permissive | from sqlalchemy import create_engine
import re
from pandas import Series, DataFrame, concat
import pandas as pd
from pymongo import MongoClient
import subprocess as t
import logging
from logging.config import fileConfig
import configparser
fileConfig('logger_config.ini')
logger=logging.getLogger('infoLogger')
class L... |
c22b6b475212808a6d684d8b41b5c60e596da7d0 | 1fcbd40a5524cafc55c5fcb0f90bff5c9bbaf2dc | jarvis-cochrane/paranuara | /paranuara/urls.py | Python | py | 825 | permissive | """paranuara URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... |
5ff3801d6716973174b11ef4641df478d7429b98 | 98b5c49ce390a0fef65741730c64726e2a192d57 | aabounegm/DS-Project2 | /storage-server/src/views.py | Python | py | 2,820 | no_license | from flask import jsonify, request, abort, current_app
from flask.views import MethodView
import requests
import os
import shutil
from src.blueprints import app
from src.config import storage_root
#==============================================heartbeat<3=========================
@app.route('/heartbeat' , methods=[... |
76700bf4860ab4caa63148d1f2a4e2d6c61ead2b | 205e26ba58218852b6fd77be0539a27b95848d59 | 532839167/SuperMario | /source/states/main_menu.py | Python | py | 3,034 | no_license | import pygame
from .. import setup
from .. import tools
from .. import constants as C
from .. components import info
class MainMenu:
def __init__(self):
game_info = {
'score' : 0,
'coin' : 0,
'lives' : 3,
'player_state' : 'small'
}
self.start... |
43eab8dc5184433d31f13d6f8ec59f83c9f333e4 | 7188fc964952a192fc3eb8e2c13b683b12c10466 | kierstiee/s1 | /catalog/migrations/0002_auto_20180215_1710.py | Python | py | 978 | no_license | # Generated by Django 2.0.2 on 2018-02-15 17:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catalog', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='bulkproduct',
name='quantity',
... |
ed2a0c2dafceeea9ba83149f56a915a6d4a6815e | 50fa2664c9978e5e96733aac8e6bac83acca5393 | bluesnie/Learning-notes | /docs/Python/第三方库/PyQt5/code/combobox.py | Python | py | 1,487 | no_license | # _*_ encoding:utf-8 _*_
__author__ = 'nzb'
__datetime__ = '2019/5/23 13:50'
from PyQt5 import QtGui
from PyQt5.QtWidgets import QApplication,QLabel, QComboBox, QVBoxLayout, QDialog, QMainWindow, QCalendarWidget, QVBoxLayout, QLabel
import sys
class Window(QDialog):
"""下拉框"""
def __init__(self):
sup... |
534eb9ed335b4106b3a05dfc602008eab2a6f0b7 | 55301259d81eec567413c79a905bb2bd8eefdbfd | ljleppan/newseye-explainer | /explainer/resources/big_collection_resource.py | Python | py | 1,091 | no_license | from typing import List, Type
from explainer.core.models import Fact, Message
from explainer.core.realize_slots import SlotRealizerComponent
from explainer.explainer_message_generator import Event
from explainer.resources.processor_resource import ReasonResource
TEMPLATE = """
en: This action was taken because the or... |
7f500d0e4ac6f492c91c76dc385d3cb13a701ed5 | 6fc9e7acb00b818470242c2fd3e01b85214c4c6f | NeuralEnsemble/python-neo | /neo/rawio/mearecrawio.py | Python | py | 7,938 | permissive | """
Class for reading data from a MEArec simulated data.
See:
https://mearec.readthedocs.io/en/latest/
https://github.com/alejoe91/MEArec
https://link.springer.com/article/10.1007/s12021-020-09467-7
Author : Alessio Buccino
"""
from .baserawio import (BaseRawIO, _signal_channel_dtype, _signal_stream_dtype,
... |
d4ffd63db2255e14cf32f5972ee040a82329a4fc | ee3c002b268980601fffb1c6f19d9eea8fc6f189 | adarshksudarsan/python_scripts | /csv/create_test_train.py | Python | py | 597 | no_license | #give the desired shape in iloc
import pandas as pd
#reading
df1=pd.read_csv('human_ch0_complex.csv',header=None)
#reshaping to desired size
df1=df1.iloc[0:3000,0:52]
'''
#to find amplitude
def every(x):
try:
x=complex(x)
return(int(abs(x)))
except:
print("fine")
return(x)
df... |
368de5324f99cde55d6bad608c86eaf925a7c4a3 | 88b16566e5d832ab92c815bb09295b6693ff2d40 | xmk844287738/flask_microblog | /migrations/versions/25e4cce195e8_create_user.py | Python | py | 1,131 | no_license | """create_user
Revision ID: 25e4cce195e8
Revises:
Create Date: 2019-09-11 19:30:48.743009
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '25e4cce195e8'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto genera... |
96debab4ec977783b822852c8da2aee111917f6c | 0f9ac7e84e02b364837296ecbd3907481b3baa57 | lDuffy/django-ckeditor | /ckeditor/views.py | Python | py | 4,416 | permissive | from datetime import datetime
import os
from django.conf import settings
from django.core.files.storage import default_storage
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from ckedi... |
937e00cdca8073e2ae0849afaadd833f9c43f829 | 063541596fb0d3ed276e6c7a63028a3d12a3737c | Nina-Om/lrose-core | /build/autoconf/createMakefile.am.lib.py | Python | py | 16,936 | permissive | #!/usr/bin/env python
#===========================================================================
#
# Create makefile.am for a LROSE lib
#
#===========================================================================
from __future__ import print_function
import os
import sys
import shutil
import subprocess
import pla... |
34ae5872006d7825eea0edf97efe7bd867e99fd6 | 3f689453c2d836cc4580d8ebc7f9d7e6827af2b5 | tomioss/drf-recipe | /app/core/migrations/0005_auto_20201107_1418.py | Python | py | 570 | no_license | # Generated by Django 3.1.2 on 2020-11-07 14:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_recipe'),
]
operations = [
migrations.AlterField(
model_name='recipe',
name='ingredients',
... |
255062ea3afdc053232f3db07d7356abd489d862 | a0666298b895d84616e73e7be8d39216cdea2ec2 | gana-chocolate/Doodles_Become_Paintings | /python/ImageCatcher/utils/postprocessing.py | Python | py | 2,987 | permissive | import tensorflow as tf
import numpy as np
def detections_to_bboxes(detections):
"""Convert detection boxes to bounding boxes.
:param detections: YOLOv3's output.
:return: The converted bounding boxes.
"""
centre_x, centre_y, width, height, attrs = tf.split(detections, [1, 1, 1, 1, -1], axis=-1)
... |
6bbd71450050c8e6dbfe485391727ac32fbd2507 | a0c29d026d716688ad6ee35cec08cc61df7d38da | bobthemighty/punq | /noxfile.py | Python | py | 3,818 | permissive | #!/usr/bin/env python3
import os
import shutil
from pathlib import Path
import nox
try:
from nox_poetry import Session
from nox_poetry import session
except ImportError:
message = f"""\
Nox failed to import the 'nox-poetry' package.
Please install it using the following command:
{sys.executa... |
af4878183962854040c464262a3f2a9a0e6cbd62 | 843f017fefb98223b2dd1e5fbd46c2ff175d5d79 | tjwilli6/ENGR_2310 | /private/temp/stanley_virtual/engr2310/Fplots.py | Python | py | 700 | no_license |
import matplotlib.pyplot as plt
n = int(input("How many term?" ))#this is the input that you put in
x2 = 1#numbers that start the fibonacci sequence
x1 = 0
a = 0
xaxis = []
yaxis = []
n= n - 1#to account for the number printing of the first term.
print(x1)# prints the first number of the fibonacci sequence
while n > 0... |
028f449afe20d7fbac6fadbde276eacf027c3279 | bf495ff2d33e800c21bf785e11e716e00c4581be | zfoborden/learn_python | /ps3-3.py | Python | py | 1,400 | no_license | # ---------------
# User Instructions
#
# Write a function, findtags(text), that takes a string of text
# as input and returns a list of all the html start tags in the
# text. It may be helpful to use regular expressions to solve
# this problem.
import re
def findtags(text):
params = '(\w+\s*=\s*"[^"]*"\s*)*'
... |
014c87d783b062560ac2302f05b5cfc88872e4cb | d43860c9adebad769752351ebb88bdf7ae2984d4 | ebrahimayyad11/data-structures-and-algorithms | /challenges/fifo-animal-shelter/fifo_animal_shelter/fifo_animal_shelter.py | Python | py | 888 | permissive | import sys
sys.path.append("/home/ebrahimayyad11/data-structures-and-algorithms/Data-Structures/stack-and-queue")
from stack_and_queue.stack_and_queue import Queue
class AnimalShelter :
cat = Queue()
dog = Queue()
def __init__(self):
pass
def enqueue(self, name, type):
if type =='do... |
24901ceee52129e313e1bb3ba530548ae20ca107 | 18a132c1771e11d3b8024d2543491261ac579938 | b2220333/pybind | /pybind/slxos/v17r_1_01a/brocade_mpls_rpc/show_mpls_bypass_lsp_name_detail/output/__init__.py | Python | py | 5,661 | permissive |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... |
f2094c8639372040207656c85b8bfbf95724cf29 | 5bdcc811bcdc53a8d8673361a1183b2736b4fa28 | Moiz-Ali-Moomin/MLSecOps | /code.py | Python | py | 2,152 | no_license | #!/usr/bin/env python
# coding: utf-8
# In[3]:
import pandas as pd
raw_data=pd.read_csv('/var/log/apache2/access.log', sep=" ")
raw_data.to_csv('log.csv')
get_ipython().system('cat log.csv')
#
# In[4]:
data = pd.read_csv('log2.csv', skiprows=2, names=['IP','Dash','Dash1','Date','TimeZone','Request_Header','St... |
9dcff3f13a204fb8c03cb5f94deab048133a2c48 | 5e7d195d6b643270aee20833572b61d0104a523f | Smekac/SemanticWeb | /flaskblog/routes.py | Python | py | 6,042 | no_license | import os
import secrets
from PIL import Image
from flask import render_template, url_for, flash, redirect, request, jsonify
from flaskblog import app, db, bcrypte
from flaskblog.forms import RegistrationForm, LoginForm, UpdateAccountForm, AddFilm
from flaskblog.models import User, Post
from flask_login import login_... |
80cc6e0b9e1c11c055d4e9f84f1f9b49f84df20c | bc84cf39c51ae28f2ed314a5a54ca72311100806 | diging/vogon-web | /annotations/quadriga.py | Python | py | 11,147 | no_license | from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from annotations.models import Relation, Appellation, DateAppellation, DocumentPosition
import xml.etree.ElementTree as ET
import datetime
import re
import uuid
import requests
from requests.auth import HTTPBasicAuth
def _cr... |
ddaeb26f5d4e054aca550c204f021641bb734eaa | 03903dc2cd503dc87d70e35a839a1e6a3b6050c5 | khyathimsit/CNF | /Module-8/Activity-6/client.py | Python | py | 403 | no_license | import socket
def main():
host = '127.0.0.1'
port = 5051
server = ('127.0.0.1', 5000)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind((host,port))
message = input("-> ")
while message != 'q':
s.sendto(str.encode(message),server)
data, addr = s.recvfrom(1024)
print("Recieved from server: " + da... |
019291de6139d6ff6e82cace5d1123b940eaab0c | 1483ea3702a57ef42c08da04e6c20d275ebc2004 | Tahmeem/DS-and-Algo | /Data Structures/Min_Heap.py | Python | py | 1,407 | no_license | class MinHeap:
def __init__(self,capacity):
self.storage = [0]*capacity #initialize array for heap
self.capacity = capacity
self.size = 0
def getParentIndex(self,index):
return (index-1)//2 #Formula to get parent
def getLeftChildIndex(self,index):
return 2 * index + 1
def getRightChildIndex(self,inde... |
6e07936aa1d3eb7967e3bbf272344f3e91d40197 | 827130b4e039eab8f4fbaff429df6eeebe7f5108 | durgesh2001/DSCLinker | /DSCLinker/asgi.py | Python | py | 395 | no_license | """
ASGI config for DSCLinker project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SET... |
3a21db8583fa6404624725803e13f53ca1a3b32e | b2b97b1a741cecde5749511816641e9467e4b1aa | smuk29/CriczScoreBoard | /src/server.py | Python | py | 523 | permissive | from flask import Flask
from mongoengine import connect
import config
import helpers.utils as Utils
server = Flask(__name__)
"""
DB Connection
"""
connect(
config.DB_NAME,
host=config.DB_HOST,
port=config.DB_PORT,
username=config.DB_USER,
password=config.DB_PASS,
authentication_source=config.... |
3f33cb008fcd6d2afb00725225fcc4842077f4f4 | 1e8da1467e4da5ce269dc0908f3648b12b6a7ee6 | typesupply/freezedryer | /build.py | Python | py | 2,911 | permissive | # -----------------
# Extension Details
# -----------------
name = "Freeze Dryer"
version = "0.1"
developer = "Type Supply"
developerURL = "http://typesupply.com"
roboFontVersion = "3.3"
pycOnly = False
menuItems = [
dict(
path="menu_launch.py",
preferredName="Projects",
shortKey=""
)
]... |
359283b46930589bd39c602d337bfbe1871091e5 | e0df41e3fea56f3ea9ec06bc0735379d30c8788f | code1990/bootPython | /python/helloPython/chapter07.py | Python | py | 1,839 | no_license | # 第7章 用户输入和while循环
# 7.1 函数input()的工作原理
# 函数input() 让程序暂停运行,等待用户输入一些文本。获取用户输入后,Python将其存储在一个变量中,以方便你使用。
message = input("Tell me something, and I will repeat it back to you: ")
print(message)
# 函数int() 将数字的字符串表示转换为数值表示
age = input("age")
age = int(age)
# 求模运算符 (%)是一个很有用的工具,它将两个数相除并返回余数
print(4 % 3)
# 7.2 while循环简介 ... |
7d7205bb82c48ae949f79488c1cd3d0bb8280aef | d1931f48e9cf626157e660e927cda36ba3264cc2 | coolsync/todo | /other-space/py/days/day03/03-lsit-query.py | Python | py | 292 | no_license | # name_list = ["bob", "mark", "jerry"]
# find_name = input('find name:')
# if find_name in name_list:
# print('exists')
# else:
# print('not exists')
a = ['a', 'b', 'c', 'a', 'b']
# print(a.index('a', 1, 3))
print(a.index('a', 1, 4))
print(a.count('a'))
print(a.count('d'))
|
327ee85a883750c5e264e9ded171335fbefcf730 | b62444ee23d7b71742e05eb48f5e5426ae238f7f | bence-szalai/olfaction-prediction | /opc_python/collaboration/feature_selection/fixit.py | Python | py | 820 | permissive | #/usr/bin/python3
import pandas as pd
train = pd.read_csv("all_features_training.csv")
valid = pd.read_csv("all_features_validation.csv")
if train.columns[[7307]] != 'nspdk1':
raise Exception('The input file doesn not seem to contain the error. Maybe it has already been fixed?')
# delete the permuted nspdk column... |
40224ca2112d0307e74c2c357c779f2f8208cc10 | 70e061fca0cbed070c7dfd03ae4dd1a97c73bd56 | huaweicloud/huaweicloud-sdk-python-v3 | /huaweicloud-sdk-lakeformation/huaweicloudsdklakeformation/v1/model/batch_update_partition_request.py | Python | py | 6,524 | permissive | # coding: utf-8
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class BatchUpdatePartitionRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is ... |
7665b744f8335b35078cd05fee7958a52ece1e54 | 41c52fd377ef0f1d7c3249da9d9695f3791e05d3 | madisongong/madison-recycle | /server/run.py | Python | py | 3,434 | permissive | import json
import os
import logging
from flask import Flask, request
from watson_developer_cloud import VisualRecognitionV3
from watson_developer_cloud import watson_service
app = Flask(__name__, static_url_path='')
app.config['PROPAGATE_EXCEPTIONS'] = True
logging.basicConfig(level=logging.FATAL)
port = os.getenv('V... |
8820fb4dae0fd9ab0f8780a7c5836dbe252b76cc | 62eb07c873fb17e7029e7fc3eb62d187803bca30 | zjjnevergg/WeChat-TFCC | /tfcc/test/python/testcase/math/div.py | Python | py | 2,505 | permissive | # Copyright 2021 Wechat Group, Tencent
#
# 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... |
6444e23fefd4be192b9592a6edc9923efa5a70da | 070f46cb38a64c52def33e62c7462df6e25d81e4 | SAP/python-pyodata | /pyodata/vendor/SAP.py | Python | py | 2,811 | permissive | """SAP extensions to OData protocol"""
import json
import logging
from pyodata.exceptions import HttpError
def json_get(obj, member, typ, default=None):
"""Tries to get the passed member from the passed JSON object obj and makes
sure it is instance of the passed typ.
If the passed member is not fo... |
1b5d54c8d99541641ab8752f2a9e11e465176cc1 | c86ed36fab3ad3074fa76b9bd04653b2771c1202 | zhenshaoaixixi0507/PythonGlobalOptimizationLib | /PythonGlobalOptimizationLib/PythonGlobalOptimizationLib/Models/GARCH11Normal.py | Python | py | 5,177 | permissive | import numpy as np
import math
import ChaoticPSOAlgorithm as PSO
def GARCH11NormalOptimize(ret:np.ndarray)->[float]:
residual=ret-np.mean(ret)
sigmasquare=np.zeros(shape=(len(residual),1))
log=np.log
pi=math.pi
def loglik(parameters:[np.ndarray])->float:
sigmasquarezero=np.mean(np.square(re... |
323c8ef723f736f822dee38e288430e564958cb6 | 2196406b0c9ebf470c1053adda0c9be3636df60c | peter-zsn/fenye | /libs/common.py | Python | py | 1,437 | no_license | #coding=utf-8
"""
@varsion: ??
@author: 张帅男
@file: common.py
@time: 2017/7/18 16:58
"""
import json
import time
import datetime
import re
def type_default_value(type):
"返回基本类型默认值, 没有识别的类型返回None"
tab = {str:"", unicode:u"", list:[], int:0}
return tab.get(type)
def casts(self, **kw):
"""批量转换url参数类型pos... |
f442a9b9ed8e9c9471cbd255541ec7920b2dd37b | 0876a3050ebe25ebc04ccb5e818330f3dd18ef7a | RedHatInsights/insights-core | /insights/tests/parsers/test_galera_cnf.py | Python | py | 1,317 | permissive | import doctest
from insights.parsers import galera_cnf
from insights.tests import context_wrap
GALERA_CNF = """
[client]
port = 3306
socket = /var/lib/mysql/mysql.sock
[isamchk]
key_buffer_size = 16M # inline comment test
[mysqld]
basedir = /usr
binlog_format = ROW
datadir = /var/lib/mysql
default-storage-engine = ... |
31037321e07b9ca482da42f64c64a34d07e7a854 | 83fb0132452b6751f00866050ddc0dbd639419b3 | MrEleden/PandroRebord | /src/gestFile.py | Python | py | 1,252 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 13 10:47:54 2017
@author: Eleden
"""
import scipy.io
class gestFile(object):
def __init__(self,file_name):
self.dicOfValue= {}
for i in range(len(file_name)):
temp = scipy.io.loadmat(file_name[i])
... |
aac5853cf8467842dc9f2fb078c040b0af1df922 | 7f081dae9998cd2d4569f9c98ab407d9acc148fd | b1ck0/python_coding_problems | /Generators/004_is_fibonacci.py | Python | py | 973 | no_license | def is_fibonacci(number):
"""
https://www.hackerrank.com/challenges/is-fibo/problem
:param number: number
:return: true if number in fibonacci sequence else otherwise
"""
def fibonacci():
current, previous = 0, 1
while True:
yield current
current, previou... |
4c12ef7fa6052f6a4521ebb15ea1d7a673f7be78 | 78807dd45e0e8d75a29ddef131900247016bef7a | jakabk/pysztaki | /pysztaki/queryparser.py | Python | py | 1,454 | no_license | from urllib.request import urlopen
from urllib.parse import quote
from bs4 import BeautifulSoup as bs
from collections import OrderedDict
from .config import BASE_URL, FROM_KW, TO_KW, WORD_KW, Languages
class SztakiQueryParser:
def __init__(self, from_lang=Languages.English,
to_lang=Languages.Hu... |
d40f7c1a5a6ec238e2926ab02ca9e2de45cc5410 | d4b327663e1dfa1608e540d210c9ebbf6bc6d9cc | Cauverypraba/CLI-Tool | /contact.py | Python | py | 2,201 | no_license | import json
with open('data.json', 'r') as store:
data = json.loads(store.read())
store.close()
def modify(data):
with open('data.json', 'w') as file:
file.write(data)
file.close()
print("----------Welcome to CLI Tool for managing contacts-----------")
print("Choose any one of the... |
304ccd72b0014517f3f00906fc2b24165888ee6b | 3a0cd5e7cb72f60d525c2b5d203a6cb0b5fb92c5 | Andrey-V-Georgiev/PythonOOP | /_06_PolymorphismLab/_01_Execute.py | Python | py | 202 | permissive | def execute(f, *args):
return f(*args)
def test_func(name, age):
return f"I am {name} and I am {age} years old"
print(execute(test_func, "Tanya", 22)) # "I am Tanya and I am 22 years old"
|
b051e4d33ce1f8ce8d4db6c87796fb4836bebae5 | 8203d1f38003ed541a585686b263134981da2a8d | Kiruen/kiruen_funbox | /funalgo/leetcode/452.py | Python | py | 457 | no_license | def removeCoveredIntervals(intvs: list):
if not intvs: return 0
intvs = sorted(intvs, key=lambda intv: intv[0])
cur_intv = intvs[0]
rest = len(intvs)
for intv in intvs[1:]:
if cur_intv[1] >= intv[1]:
rest -= 1
else:
cur_intv = intv
return rest
if __name_... |
4a5bcb5321d140ad0fe9ff96b48dc0783c4c4ddf | debe6959f1321dd5db35a56857c874bad7f8d477 | judebues/softmanage | /manage/lib/python3.7/site-packages/django_crontab/crontab.py | Python | py | 6,034 | permissive | from __future__ import print_function
import fcntl
import hashlib
import json
import logging
import os
import tempfile
import sys
from importlib import import_module
from django.conf import settings
from django_crontab.app_settings import Settings
string_type = basestring if sys.version_info[0] == 2 else str # fl... |
4e7c75cc949af5f64f4081f551eaee31cdba073d | 727016ab62788d7247f376b313906351e28fe858 | pnayak333/Learn_Python_Basic_Programs | /Anonymous_Power.py | Python | py | 297 | no_license | #Program to display Anonymous power of values
num = int(input("Value: " ))
res = list(map(lambda x: 2 ** x, range(num)))
op = list(map(lambda x : x ** 2, range(num)))
for i in range(num):
print("2 to the Power of", i , "is:=", res[i])
print(i, " to the power ", i,"is=",op[i]) |
172a752daa8e5ed90bf16948b0311452566b20f3 | fb26b57308daa80cdc8b26d86a015c8cf5fe9e4b | BikashSah999/Online-Competition | /dashboard/migrations/0001_initial.py | Python | py | 556 | no_license | # Generated by Django 3.0.6 on 2020-06-18 17:36
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField... |
4dbeb5e88cb74c8cb80e83f886a65ce617decda8 | 4286eca84b3b56ca0792e7efa45be36e32aac8fb | magicrobotmonkey/sentry | /src/sentry/web/api.py | Python | py | 23,754 | permissive | """
sentry.web.views
~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import datetime
import logging
from functools import wraps
from django.contrib.auth.models import AnonymousUser, User
from django.core.urlresolvers import ... |
80bfbe9ca0bf18302462fbfacc88e35b21b6a689 | 33bdfae924d8d1635ae54acaeb90dd665b804dd3 | Rae-Jiang/1004-big-data | /lab-2-hadoop-Rae-Jiang/joins/src/join_mapper.py | Python | py | 1,998 | no_license | """
you are given two data files in comma-separated value (CSV) format. These data files (joins/music_small/artist_term.csv and joins/music_small/track.csv) contain the same music data from the previous lab assignment on SQL and relational databases. Specifically, the file artist_term.csv contains data of the form
... |
3ce25aeaa21851c58146b5ad0992f972b45cae38 | e7f0e64226a77b25cb22933c4b7a6599b8855870 | Crapworks/ceph-dash | /app/graphite/views.py | Python | py | 1,788 | permissive | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import ssl
import json
from flask import jsonify
from flask import current_app
# import urlopen from urllib.request / Python3
# and fallback to urlopen from urllib2 / Python2
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
fro... |
5bc59f4506d973ae34f0d64fab9ff3d48170da8e | 1bd78d021b77d1e52b2d434daa1c487cfbd5c246 | swhui/cs61a | /lab12/lab12.py | Python | py | 9,233 | no_license | from operator import add, sub, mul
def prune_min(t):
"""Prune the tree mutatively from the bottom up.
>>> t1 = Tree(6)
>>> prune_min(t1)
>>> t1
Tree(6)
>>> t2 = Tree(6, [Tree(3), Tree(4)])
>>> prune_min(t2)
>>> t2
Tree(6, [Tree(3)])
>>> t3 = Tree(6, [Tree(3, [Tree(1), Tree(2)])... |
28e22e2c4e3041f9f2c73be1a2d275295bc83cee | f52e9087664fe611e023941095bb2e16bccfa7e1 | ShawnTaylor1969/iko_website_22 | /api_events/models.py | Python | py | 4,346 | no_license | from django.db import models
from datetime import timedelta, datetime
from django.utils.text import slugify
import itertools
from django.dispatch import receiver
from django.db.models.signals import post_save
#models
from django.contrib.auth.models import User
from api_eventschedules.models import EventSchedule
class... |
dffa8d8e944764e6bb681491bb0c66dba67fd32f | 6c551d6af45a8fb158a44248cf1698f6a99abf0d | InfAurora/python_projects | /dogGenetics.py | Python | py | 1,108 | no_license | import random
def main():
resultsAdded = 0
name = input("What is your dog's name? ")
print(f"Well then, I have this highly reliable report on {name}'s prestigious background right here.\n")
print(f"{name} is: \n")
genResults = genetics()
if genResults[0] != 0:
print(f"{genResults[0]... |
9b55fcbe5672330bacad7a8066dbad1cad0f8645 | 44588be6e53fe3cd8f1dcbe056d1560d2c55b272 | rodrigobmg/psx | /SLPS-01416/ida/overlay_d/make_psx.py | Python | py | 15,951 | permissive | set_name(0x80139BFC, "GameOnlyTestRoutine__Fv", SN_NOWARN)
set_name(0x80139C04, "GetDamageAmt__FiPiT1", SN_NOWARN)
set_name(0x8013A1FC, "CheckBlock__Fiiii", SN_NOWARN)
set_name(0x8013A2B0, "FindClosest__Fiii", SN_NOWARN)
set_name(0x8013A43C, "GetSpellLevel__Fii", SN_NOWARN)
set_name(0x8013A4B0, "GetDirection8__Fiiii", ... |
5e490004c0e48cff94b3f206b0102d779e98db22 | fd98c0c29b97f385d0b4766eeafd29f51d64d75b | Aiswarya333/Python-Lists | /list2.py | Python | py | 477 | no_license | '''REVERSE ORDER - Write a program that
reads integers from the user and
stores them in a list.
Use 0 as a sentinel value to mark the end of the input.
Once all of the values have been read your program should display them (except for the 0)
in reverse order, with one value appearing on each line.'''
... |
02bbe8f3dff6dab233fa96b5a361b2a218bf2a39 | 9396b430e9525bc47a3f31be556473a1a3ed71d8 | isoundy000/learn_python | /tu_you/parse_config/config_parse.py | Python | py | 325 | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
__author__ = 'ghou'
import time
from openpyxl import load_workbook
import os, sys, json, copy
import collections
import re
import csv
import traceback
from multiprocessing import Queue, Process, cpu_count, freeze_support
def getOutPath(dirname, filename="0.json"):
pa... |
34f9e4fc39756d8cabfca0db0b2874c7f4b71410 | 492adff2559f3759a0d5fffa7380db457b1d2f17 | xushengan/myproject | /boards/views.py | Python | py | 1,779 | no_license | from django.shortcuts import render, get_object_or_404,redirect
from .models import Board, Topic, Post
from django.contrib.auth.models import User
from .forms import NewTopicForm
""""
day 1
def home(request):
boards = Board.objects.all()
boards_names = list()
for board in boards:
boards_names.app... |
ef41627ff0de7a54ded562a8900e956b572b155e | d2695f5812b87b4bbcd897f4de8e87d2fa1c0457 | ivarygin/django-rest-chat | /simple_chat/urls.py | Python | py | 692 | no_license | from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth import logout
from rest_framework.urlpatterns import format_suffix_patterns
from chat_app.views import *
urlpatterns = [
url(r'^$', login_redirect, name='login_redirect'),
url(r'^admin/', admin.site.urls),
url(r'^... |
af82ac3ed800528780df324b6e13a37cd1fd3103 | 755eaff67173df43464cc4e50af2bde587ff73f8 | Kkari/bsc_thesis | /my_rbm.py | Python | py | 24,089 | permissive | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow.contrib.distributions as tf_dist
import numpy as np
def variable_summaries(name, var):
"""Attach a lot of summaries to a Tensor."""
with tf.name_scope('summaries'):
mean = tf.reduce_mean(var)
t... |
6fb99943b87dce44ae388f35db7880da4a4cb247 | 3da875d3bc651381e83b0d8eb452ca010242bc94 | codeduardo/CobraS.A | /forms.py | Python | py | 872 | no_license | from flask_wtf import FlaskForm
from wtforms import StringField,IntegerField,SubmitField,TextAreaField,PasswordField
from wtforms.validators import DataRequired,Length,Email
class FormularioForm(FlaskForm):
nombres = StringField('nombres',validators=[DataRequired(),Length(min=5,max=40)])
apellidos = StringFiel... |
43039aa4d3214c1b4160008fe7690afcb1cbec93 | 695d67f9519d9fce5732fbd01e3a2994feee0dc4 | SimpleITK/SimpleITK | /Examples/LandmarkRegistration/LandmarkRegistration.py | Python | py | 2,074 | permissive | #!/usr/bin/env python
# =========================================================================
#
# Copyright NumFOCUS
#
# 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:/... |
41f1b0cd9386b9188f037bfcaefacc8a7ee4e334 | 3435fb3385431c6d6fe8956da37bb91b05f16b53 | ccmeffeng/Enzymatic_reaction | /rnn_test_3.py | Python | py | 5,776 | no_license | import numpy as np
import tensorflow as tf
# max_len = 150
# num = 10664
class ReactionData():
def __init__(self, st ='training'):
if st == 'training':
self.data = np.load('training_set.npy').tolist()
self.labels = np.load('training_set_label.npy').tolist()
pri... |
7495f3f5dfd00340b35db8d1e98aeff29bb9896a | 4c17acbb2e055d93fdf94121239f7a7ef3eda528 | risd/steam-map-geo-data | /04_toplevelgeo/03_tsv_districts/create.py | Python | py | 2,168 | no_license | # write out districts and centroids for toplevelgeo import
from os.path import abspath, dirname, join
import fiona
from shapely.geometry import shape
import us
DEBUG = True
DATA_DIR = dirname(dirname(dirname(abspath(__file__))))
# districts
PATH_DISTRICT = join(DATA_DIR,
'00_data_original/' ... |
d143dee1d03c0f1881333b3a7def6277b30336a8 | e19052a08eacc4cb84923c3147b9db347cfafbc3 | iron-bun/project-euler | /problem_023.py | Python | py | 1,457 | no_license | #!/usr/bin/env python3
#A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
#A number n is called deficient if the sum of its proper divisors i... |
b3fa7ee38c8816ef79db5080aef3116f2031450b | 2d3d61d731379e78b76ce863260756cf56c7f35a | giganano/VICE | /vice/yields/ccsne/S16/__init__.py | Python | py | 1,051 | permissive | r"""
Sukhbold et al. (2016), ApJ, 821, 38 core collapse supernova yields
**Signature**: from vice.yields.ccsne import S16
.. versionadded:: 1.2.0
This yield module provides a number of sub-modules with which to update CCSN
yield settings according to the Sukhbold et al. (2016) study. This module,
however, does not i... |
d346a9a4e05189e585e873c8ef37ee34d7d341f5 | 7bd5a6fe5f1ae7a40f8887c5de4e096db978345a | RoshanPRaj/GitHubLeetcode | /last_word_length.py | Python | py | 337 | no_license | class Solution(object):
def lengthOfLastWord(self, s):
"""
:type s: str
:rtype: int
"""
s = s.strip()
if s == '':
return 0
t = s.split(' ')
if t[-1] == ' ':
return len(t[-2])
if len(t) > 0:
return len(t[-1])
... |
6d2a6c5af1a7fd68af6e99a341dcc7282cb9c2a1 | 435432b5466fe08f1d4fcaf2dea03c97b8f30f77 | Kkoding/2DGP | /BackGround.py | Python | py | 3,057 | no_license | from pico2d import *
import game_framework
from main_state import *
class BackGround:
Map1, Map2, Map3 = 0,1,2
def __init__(self):
self.stage1 = load_image('BackGround\\03.png')
self.stage2 = load_image('BackGround\\07.png')
self.stage3 = load_image('BackGround\\12.png')
self.Cloud1= load_image('B... |
d183d94c90e364f406dcc760e0d934c1fa7ceadc | 6326c61a7327b84db49cef52b96e6c1b83e0d8b9 | thornb/FoFSimulation | /2013-communities-detection/gowalla.py | Python | py | 6,749 | no_license | ########################################################
# The purpose of this script is to interact with the
# MongoDB database. This script currently supports
# launching data from MongoDB directly to the code
# and loading the data from the disk to the code
# ---------------------------------------------------
# Au... |
400bd4487d05f30f2007fa2471b7fd0fbd733cb5 | daae0520c995d1fb48f65e6153ad3e4890d01cbb | OlivierGallant/trend_forecast | /python/mplwidget.py | Python | py | 1,052 | no_license | # ------------------------------------------------------
# -------------------- mplwidget.py --------------------
# ------------------------------------------------------
from PyQt5.QtWidgets import*
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
class MplWidget... |
d15f7eae1cf2a3b7b11d34206e83c37361f3f3cc | ed796409586fb9c4d8b3d59b87a022f9354b7194 | RoyFalik/FlaskTest | /flask-helloworld/flaskr/__init__.py | Python | py | 1,074 | no_license | import os
from flask import Flask
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY='dev',
DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'),
)
if test_con... |
5c24d9e2412789a5cbd7a85e9a962177f47f6f76 | f8265428d150cea593a5fbd9da93b97eedfd35fd | rafaelcbc/robotexpert | /resources/libs/DeloreanLibrary.py | Python | py | 1,506 | no_license | import psycopg2
from logging import info
class DeloreanLibrary():
def connect(self):
return psycopg2.connect(
host='ec2-3-234-85-177.compute-1.amazonaws.com',
database='d7lvcfh7tv8hts',
user='kspvidrcffyoll',
password='b1f5878c3d2b52ce198f7a7fc51ac6fab29d445... |
be76d810c4f2d139b9b34b153506d88af85cfa79 | ce67f737b0ae1ea672a177bcb8db781d4ff0d5d2 | rathihimanshu/beam | /sdks/python/apache_beam/runners/direct/transform_evaluator.py | Python | py | 32,656 | 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... |
561fbb5300c17f696cc411cac60c748c79f1dc7e | 28495604a89d7888c04093d1e2ab0f5b07a23cff | Minilulatsch/PcapPlusPlus | /Tests/ExamplesTest/tests/test_pcapsearch.py | Python | py | 2,303 | permissive | from os import path
import pytest
import re
import ntpath
from test_utils import ExampleTest
class TestPcapSearch(ExampleTest):
pytestmark = [pytest.mark.pcapsearch, pytest.mark.no_network]
@pytest.mark.parametrize(
"search_criteria,expected_packet_count",
[
pytest.param('tcp port 80', 3541, id='tcp_port_80'... |
0976e05fb18de74aebef47f78a6eebeb0763ef04 | 5f363db6e03a3024b6c2431f1c9c22191d258ff6 | sibirrer/lenstronomy | /lenstronomy/LensModel/Profiles/pemd.py | Python | py | 5,620 | permissive | __author__ = 'sibirrer'
from lenstronomy.LensModel.Profiles.spp import SPP
from lenstronomy.LensModel.Profiles.spemd import SPEMD
from lenstronomy.LensModel.Profiles.base_profile import LensProfileBase
import lenstronomy.Util.param_util as param_util
import numpy as np
__all__ = ['PEMD']
class PEMD(LensProfileBase)... |
bd51562a47ea521400f3e38cae507fa4b2a1a824 | 823d3aa818f4b1c6ac0d1000a8cb75376638ccfd | gavinljj/feature-store-api | /python/hsfs/storage_connector.py | Python | py | 21,566 | permissive | #
# Copyright 2020 Logical Clocks AB
#
# 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 ag... |
dd9373bd13986d588765126c2d98d1a6291b120a | 39eb289d651c42c4529b8eebb006f4940af20c0c | feima0969thu/zhaofeng-shu33.github.io | /generate_index.py | Python | py | 4,343 | permissive | # this script generate contents for qzone_blog
# contents exported using tools https://github.com/wwwpf/QzoneExporter
# usage: python3 generate_index.py --dir qzone_blog
import os
from datetime import datetime
import argparse
def get_dics():
''' handle qzone
'''
content_dic = {}
for dir_path, dir_name,... |
7d8961ba61812597c17b3c1f235c083a4444f0b0 | bb9bbde5a7a93663a5808354f1a4b28696e7d484 | alede379/supermariopy | /supermariopy/pandaslib.py | Python | py | 3,823 | permissive | import pandas as pd
def listify_dict(dict_):
"""Takes a dictionary and replaces all non-list values with a list
with same length as the rest of the list values.
If not list is present in the dict, every value will be turned
into a list of length 1.
This function is useful to convert dicts in pan... |
cfa20825d9cf87f4ef0d798f991c74dbf43f0387 | d0418ddcdca6453ab349e34e9779b5b06f5b82bd | elvisochieng/emunyo-contractors-ltd | /posts/models.py | Python | py | 524 | no_license | from django.db import models
class Post(models.Model):
title = models.CharField(max_length=100)
body = models.TextField()
width = models.IntegerField(default=0)
height = models.IntegerField(default=0)
image = models.ImageField(null=True, blank=True, width_field='width', height_field='height')
slug = mode... |
d5c8366401756902a3a4db8f561b7755075b1445 | 50c1a6490f8be937dbdcf73a620ac08f26efb029 | rplasschaert/python-scripts | /single byte xor.py | Python | py | 323 | no_license | import binascii
encoded = '1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736'
strings = binascii.unhexlify(encoded)
for key in range(256):
decoded = []
for string in strings:
xorred = chr(ord(string) ^ key)
decoded.append(xorred)
dec = ''.join(decoded)
print(hex(key))
print(dec)
... |
8eeda2dd882bee37067accdac553dbdd242ecfd6 | 3cc327d545bafd63558808a78122ebd216163f6c | cornkle/proj_CEH | /surface_wavelet/paper_filtered_ERA_map_AMSRE_timeseries_plot.py | Python | py | 69,561 | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 4 10:15:40 2016
@author: cornkle
"""
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt
import matplotlib
import ipdb
import pandas as pd
import glob
from utils import u_met, u_parallelise, u_gis, u_arrays as ua, constants as cnst, u_grid, u_darrays
... |
2748d1e684b7e10d295eafdd08f5320c31a61ddf | 72054c177531b520d73e85631192ba56ec6655ab | mangostory85/MangoServer | /st01.Python기초/py45상속/py45_09_FourCal/FourCal.py | Python | py | 1,504 | no_license |
# 작업 순서
# 1. 모듈 또는 클래스 import
# 2. 클래스명은 파스칼 표기법으로 정한다. 첫글자는 대문자로.
# 생성자 선언 : 인스턴스가 생성될 때 실행
# 소멸자 선언 : 소멸자는 인스턴스가 소멸할 때 실행
# __str__() 메서드 오버라이딩
# 접근자( getter ) 메서드 선언. 비공개 인스턴스 변수 읽기
# 설정자( setter ) 메서드 선언. 비공개 인스턴스 변수 수정
# 사용자 메서스 선언
# 3. main() 메서드 만들기
# 인스턴스 생성
# 4. 이 모듈이 단독으로 사용되면 mai... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.