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 |
|---|---|---|---|---|---|---|---|---|
abc08a5812fcda344c0280b2300ed66f7839a553 | 5ef3ec4f81251b4d2de18ad45c44cb9dc4681a36 | tsopnangsr/Python_everybody | /Course 5 - Python Data Visualization/week4/gmane/gline.py | Python | py | 2,013 | no_license | import sqlite3
import time
import zlib
import re
conn = sqlite3.connect('index.sqlite')
cur = conn.cursor()
cur.execute('SELECT id, sender FROM Senders')
senders = dict()
for message_row in cur :
senders[message_row[0]] = message_row[1]
cur.execute('SELECT id, guid,sender_id,subject_id,sent_at FROM Messages')
me... |
c9be1d6a3385cf93ddc11e71a4d8ffeb59ca3978 | 98633906ff94b394a1dd22f767f3e08be6d5c47f | jjkjiang/cs164 | /project/topo.py | Python | py | 676 | no_license | #!/usr/bin/python
from mininet.node import Host,OVSSwitch,Controller
from mininet.link import Link
h1 = Host( 'h1' )
h2 = Host( 'h2' )
h3 = Host( 'h3' )
h4 = Host( 'h4' )
s1 = OVSSwitch( 's1', inNamespace=False )
#s2 = OVSSwitch( 's2', inNamespace=False )
c0 = Controller( 'c0', inNamespace=False )
Link(h1,s1)
Link(... |
e6d111f9d2cf22406648c7f9d797a8ce2616d597 | d74905ff8ac1bdbd849b6970a6b2efbd4c2194fc | YangYangL/Strategy-evolution | /evolution_under_Extortion_strategy/Y_strategy_based_dqn.py | Python | py | 1,301 | no_license | import gym
from DQN_class import *
# ENV_NAME ='Reated_Envolver'
ENV_NAME = 'CartPole-v0'
EPISODE = 10000
STEP = 300
TEST = 10
def main():
env = gym.make(ENV_NAME)
agent = DQN(env)
for episode in range(EPISODE):
# initialize task
state = env.reset()
# Train
for step in ra... |
493d1d658c85540b3373038fdf65b622b087a529 | 5d4fd08ea2202e682e5fb1768b15e8a21c659bb5 | CS1803-SE/The-First-Subsystem | /mySpider/spiders/Museum177.py | Python | py | 1,701 | no_license | #!/usr/bin/python3.7
# -*- coding: utf-8 -*-
# @Time : 2021/4/25 10:12
# @Author : zqy
# @File : Museum177.py
# @Software: PyCharm
from ..items import *
import re
class Museum177(scrapy.Spider):
name = 'Museum177'
allowed_domains = ['baike.baidu.com']
start_urls = ['https://baike.baidu.com/item/%E... |
373c9013171a45012a178467f7b37f7146fb81cf | def07e850ddbd2abc91cad1ca9b08315cebaaf7a | karllark/package-template | /docs/conf.py | Python | py | 7,168 | permissive | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this file.
#
# All configurati... |
70e376e81e6dbb6ed7fdbc21c6066d1dc8b13aaf | aa6cf7782e3d3c6586a9fd7dc43fe97ed818872f | LaurensEiroa/Convolutional-Neural-Network-from-scratch | /to_execute.py | Python | py | 2,738 | no_license | import numpy as np
import os
from Model import Model
def load():
data_sets = ['training_digits_images_mnist.npy', 'training_digits_labels_mnist.npy', 'test_digits_images_mnist.npy',
'test_digits_labels_mnist.npy']
""", 'training_fashion_images_mnist.npy',
'training_fashion_labels... |
f6966346d9d87d4a2c9a49957193d2fd37b0e896 | c5efb11b81a26ea2d0c6f2c42c600b25b9cd1513 | rdempsey/testdriven-app | /services/users/project/tests/base.py | Python | py | 403 | no_license | #!/usr/bin/env python
from flask_testing import TestCase
from project import create_app, db
app = create_app()
class BaseTestCase(TestCase):
def create_app(self):
app.config.from_object('project.config.TestingConfig')
return app
def setUp(self):
db.create_all()
db.session.c... |
523bb3d3e842356409545fa7d0cbc608a1c47932 | 91ca35e42b47a2dae3987fe5639514125d33d929 | AssumeACanOpener/data_science_edX | /Module2/assignment2.py | Python | py | 550 | no_license | #!/usr/bin/python3
import pandas as pd
# TODO: Load up the 'tutorial.csv' dataset
#
# .. your code here ..
df = pd.read_csv('Datasets/tutorial.csv')
# TODO: Print the results of the .describe() method
#
# .. your code here ..
print('Pandas describe method:')
print(df.describe())
# TODO: Figure out which indexing ... |
52b4f692c759cadeb7bf83801f668f4d590adc5e | 862ee75bde425c3fbe446a8833ec6b4bbe34d901 | jrkns/streamlit-proj-01 | /tensorflow_model/model.py | Python | py | 4,373 | no_license | import os
import pickle
import random
from collections import defaultdict
import numpy as np
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Embedding, Dense, Dropout, LSTM
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.preprocessing.sequence import pad_sequence... |
f4d68706571fd894bf0109ffa158935fc563239c | 110c327b39fe10fce4e7c417380ac971bf1b3f01 | tharcissie/urblog | /article/home/views.py | Python | py | 3,895 | no_license | from carticle.forms import *
from django.db.models import Q
from django.forms import ModelForm
from django.urls import reverse_lazy
from carticle.models import Article, Comment
from django.views.generic import ListView, DetailView, RedirectView
from django.http import HttpResponse, HttpResponseRedirect
from django.shor... |
01c10802e28cd67fd22ebd5df490b7a48a9f731d | 49e4a242407ff87ed159993ebcb9d9b7336d6399 | tammerb/mae298-optimal-control-RL | /custom_env/Continue_training_model.py | Python | py | 1,380 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 1 20:28:43 2020
@author: thomas
The function in this script open a model and trains it for the given number of timesteps
"""
import gym
env_dict = gym.envs.registration.registry.env_specs.copy()
for env in env_dict:
if 'CustomAnt-v0' in env:... |
9f843eb12ddf457c1b0edcc7cb6a459745e1529c | c5e9d4f79d40d2e294d6566e51789425974df7d7 | kaiwensun/leetcode | /0501-1000/0853.Car Fleet.py | Python | py | 504 | no_license | class Solution(object):
def carFleet(self, target, position, speed):
"""
:type target: int
:type position: List[int]
:type speed: List[int]
:rtype: int
"""
posi_speed_list = sorted(zip(position, speed))
time = res = 0
for posi, speed in posi_sp... |
88edc870fa789b0486d5a87ea96dca5a534be60b | e4fe73b1c633c2d6b92f6e218aa60447e2ff99aa | vincent-mayer/sai2_environment | /real_robot_dEE_impedance.py | Python | py | 2,008 | no_license | import redis
from sai2_environment.robot_env import RobotEnv
from sai2_environment.action_space import ActionSpace
import numpy as np
import time
from PIL import Image
import cv2
import matplotlib.pyplot as plt
from collections import deque
def main():
action_space = ActionSpace.MT_EE_POSE_IMPEDANCE
env = ... |
0cc3dfa3cc497970bb561ed351e1c96dacb9941e | 38aecff5c74086e842cd9792454ab5fca82cf6cb | tylerjwoods/nfl_game_predictor | /merge_games_.py | Python | py | 962 | no_license | import numpy as np
import pandas as pd
import copy
from src.merge_games import merge_game_ids
def merger(num_games):
'''
From the function 'nfl_stats_aggregator.py', the aggregated_2014_to_2019.csv file
was created and stored in data/ folder.
This csv has two rows per game, one for the home team and o... |
58e4fefccee0ab8f5de09517d651e02629151bae | d339fb0edcdc689b5c772ddffd0b2f9ab47f51e4 | tclancy/cricket | /cricket/django/model.py | Python | py | 505 | permissive | from cricket.model import Project
class DjangoProject(Project):
def discover_commandline(self):
"Command lineDiscover all available tests in a project."
return ['python', 'manage.py', 'test', '--testrunner=cricket.django.runners.TestDiscoverer']
def execute_commandline(self, labels):
... |
4a68b41c0f46d373724ffc4a0cedde62abcc58d7 | 4e579359eabcd0ed1aab9df640d6ff0237347bcb | Natalia1190/Buscar | /buscar.py | Python | py | 306 | no_license | fname = input("Enter file name: ")
fh = open(fname)
count = 0
for line in fh:
line = line.rstrip()
if line.startswith("From:"):
line = line.split()
count = count + 1
print (line[1])
print("There were", count, "lines in the file with From as the first word")
|
3b739210a855e9053807d9d04e3743f507fc44d3 | c9ce3ecc878d751707afb7e40bbc685274f586aa | eglrp/studyseg | /config/semantic-segmentation-pytorch/train.py | Python | py | 12,684 | permissive | # System libs
import os
import time
# import math
import random
import argparse
from distutils.version import LooseVersion
# Numerical libs
import torch
import torch.nn as nn
# Our libs
from dataset import TrainDataset
from models import ModelBuilder, SegmentationModule
from utils import AverageMeter
from lib.nn import... |
a0bb1a95df325914501a721613964af260d43cdd | a59deee7160554f278f28a124c9dac8b06ed2aff | chadrik/doc484 | /tests/test_convert.py | Python | py | 1,806 | permissive | from __future__ import absolute_import, print_function
import logging
import pytest
from lib2to3.refactor import RefactoringTool, get_fixers_from_package
from doc484.__main__ import _main as main
def convert_string(input):
tool = RefactoringTool(get_fixers_from_package("doc484.fixes"))
tree = tool.refactor_s... |
b629592a2f197b3e33e6ad0729391b5bc3ead610 | e737c771db34b4ffb376508c92df4ebb4ec7b720 | NicholasSlaughter/PyRockPaperScissors | /RockPaperScissors/RockPaperScissors/RockPaperScissors.py | Python | py | 505 | no_license | from tkinter import *;
import ChoiceSelection;
def main():
root = Tk();
root.title('Rock Paper Scissors in Python');
root.geometry("300x75");
welcomeLabel = Label(root, text="Welcome to Rock Paper Scissors in Python");
welcomeLabel.pack();
playButton = Button(root, text="Play", font=20);
... |
a93ea1d3e0400edcad6bc567e6fb5802bd2ecadf | fc86963f7d02995aa26346bc221a8c0ff9960bcf | wbsljh/caravel | /caravel/caravel_config.py | Python | py | 2,375 | permissive | from security import CustomSecurityManager
#---------------------------------------------------------
# Caravel specific config
#---------------------------------------------------------
ROW_LIMIT = 5000
CARAVEL_WORKERS = 16
CARAVEL_WEBSERVER_PORT = 8088
#---------------------------------------------------------
#--... |
76d92cdd83c49b475af39c24dc600662487c9295 | 4f204199e5efbfe05ae533f3d52cff1cc03f437e | VU-Cog-Sci/retino_HCP | /retino_HCP/ridge.py | Python | py | 7,166 | permissive | import numpy as np
import nibabel as nb
import matplotlib.pyplot as pl
from math import *
import json
import os
import glob
import gc
import sys
import platform
import tables
from joblib import Parallel, delayed
from sklearn.linear_model import Ridge
import popeye.utilities as utils
from popeye.spinach import gener... |
04723d9c44aece0a443653f0fbe764b38b64057d | 525e2b3bc91f0c44f43eb5a3fef7dc8cf320ba21 | ralevn/Python_scripts | /hackerranked/combinations2.py | Python | py | 345 | no_license | #!/bin/python3
"""
https://www.hackerrank.com/challenges/iterables-and-iterators/problem
"""
import itertools
n = int(input())
lst = input().split()
k = int(input())
numa = 0
numcombs = 0
combs = itertools.combinations(lst,k)
for c in combs:
if c.count('a') != 0:
numa += 1
numcombs += 1
print('{:5f}... |
2527b12c9ae73ca5d4e564a18b4575110add5e00 | 8c89b509e4ca2ceb627144e1e6b3b51bf824d7b5 | Qiangzi-pro/BeautyDesign | /PerformanceCounter/article40/Aggregator.py | Python | py | 1,999 | no_license | """
负责根据原始数据计算统计数据
"""
import sys
from typing import List, Dict
from PerformanceCounter import RequestInfo, RequestStat
class Aggregator(object):
def aggregate(self, request_infos: Dict[str, List[RequestInfo]], duration_in_millis: int) -> Dict[str, RequestStat]:
request_stats = dict()
for api_name... |
21f46a5822194b0c9eed8a9da86ec730ded256ca | eaa183ce86129c88d58c68f32e0b1fdb4205e1b3 | gretushka/django_hw | /site-form-works/car_admin/app/admin.py | Python | py | 497 | no_license | from django.contrib import admin
from .models import Car, Review
from .forms import ReviewAdminForm
class CarAdmin(admin.ModelAdmin):
list_display = ('brand', 'model', 'review_count')
list_filter = ['brand']
search_fields = ('brand', 'model')
class ReviewAdmin(admin.ModelAdmin):
list_display = ('... |
d9bd653c5787b54b70d2dcff3b239869db71fb8b | 48a2d4ff14889bc447e11cb54d0bd8d200fb6b87 | vintasoftware/Ahem | /setup.py | Python | py | 875 | no_license | #!/usr/bin/env python
try:
from setuptools import setup
except (ImportError, err):
from distutils.core import setup
from ahem import VERSION
setup(
name='Ahem',
version='.'.join(map(str,VERSION)),
description='Simple, but rich, declarative notification framework for Django',
packages=['ahem'],... |
ecbeb6157f55bbeb2a4a3f0e886bb0fbb114384e | 8431c059fbfbd24b6cac33b03472391c5192b8d9 | jimmyeva/AI-predict | /P&G/online_v1_log/pre_algorithm_recomputation.py | Python | py | 49,616 | no_license | # -*- coding = utf-8 -*-
'''
@Time: 2019/5/20 17:25
@Author: Ye Jinyu
'''
# -*- coding = utf-8 -*-
import pandas as pd
import numpy as np
import warnings
import math
from datetime import timedelta
from datetime import date
warnings.filterwarnings("ignore")
import pymysql
import traceback
import sys
import time
import... |
dc140d199df74b70232ebc8c00d7752969777e50 | aafb410eed415d4982be9069a83ff0c6a8c89b5e | mcflugen/terrainbento | /terrainbento/derived_models/model_208_basicDdVs/model_208_basicDdVs.py | Python | py | 6,703 | permissive | # -*- coding: utf-8 -*-
"""
model_208_basicDdVs.py: erosion model using linear diffusion,
thresholded stream power, and discharge proportional to effective drainage
area. The threshold varies in space and time, increasing linearly with
cumulative incision depth below initial topographic surface.
Model 208 BasicDdVs
"... |
ad16849dbb4d4b58824a00dc9b5e2164ffeb92ed | 77e0b671c013f0fd1265f9ee4ba6ff19258d202a | luozhibo2003/InterAutoTest_W | /utils/LogUtil.py | Python | py | 2,176 | no_license | # -*- coding:utf-8 -*-
import logging
from config import Conf
import datetime, os
from config.Conf import ConfigYaml
# 定义日志级别的映射
log_l = {
"info": logging.INFO,
"debug": logging.DEBUG,
"warning": logging.WARNING,
"error": logging.ERROR
}
# 1、创建类
class Logger:
# 2、定义参数
# 输出文件名称,Loggername,日志级... |
a65ce6bf3a041bffb1cc316d9862f9b99ef48813 | 92ba3a64e2fbfb0305323aa99f7130deebdaf6c3 | KIVUOS1999/rest_api_for_medicines | /updown/wsgi.py | Python | py | 389 | no_license | """
WSGI config for updown project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTIN... |
2503829e10269b7217320b903ab6e7c3e9c7f403 | 5390c7dd476887a63674492b78a9c69ecbe1560f | mandaarp/thesis | /demo/main.py | Python | py | 2,100 | no_license | import sys
import os
from glimpse.glab import *
TRAIN_PERSON_BACK = '/home/mandar/thesis/demo/images/train/person-back'
TRAIN_PERSON_FORWARD = '/home/mandar/thesis/demo/images/train/person-forward'
TRAIN_PERSON_LEFT = '/home/mandar/thesis/demo/images/train/person-left'
TRAIN_PERSON_RIGHT = '/home/mandar/thesis/demo/im... |
822111b398fe2c0afeb3ff4f8057838069d488a7 | 09282a45aa2016055e0e4e1634c00e1186cf0844 | kyrias/limnoria-darksky | /DarkSky/config.py | Python | py | 2,723 | no_license | ###
# Copyright (c) 2019, Johannes Löthberg
# 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 source code must retain the above copyright notice,
# this list of condit... |
ae2e389675c4e8ccbd6c63daf0e7896c1640afb7 | c28c712e576209b599700f1b99bff53b736708a4 | Unix4ever/ogre | /Samples/Python/numpy_sample.py | Python | py | 2,020 | permissive | import Ogre
import OgreBites
import OgreRTShader
import OgreNumpy
import numpy as np
from matplotlib import pyplot
def main():
app = OgreBites.ApplicationContext("PySample")
app.initApp()
root = app.getRoot()
scn_mgr = root.createSceneManager()
shadergen = OgreRTShader.ShaderGenerator.ge... |
874e21fd0f0c7f3ae82994a780d171cfdb4311b6 | 11f2ca5a8726f3c101af8f72bda6b16a5e535811 | fuxinhan/aaron | /online-master/src/apps/users/migrations/0003_auto_20181117_0846.py | Python | py | 466 | permissive | # Generated by Django 2.1.3 on 2018-11-17 08:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0002_auto_20181116_1505'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='name',
... |
f107721ee804a573084c1f0ef270659e03c4c2dd | b4b5a0a1ac73b0ec8bea5d7d812f8fa36e53cc23 | adparadise/kivy-pong-example | /main.py | Python | py | 4,003 | no_license | from kivy.config import Config
Config.set('kivy', 'keyboard_mode', 'system')
import kivy
kivy.require('1.0.8')
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ReferenceListProperty,\
ObjectProperty
from kivy.vector import Vector
from kivy.clock import Clock
... |
40ca145971f3d137c86ebed2ed2111945962d552 | 3dec48449cc35592787347905bfb17464147f8ba | villancikos/book1-exercises | /Course materials/Chapter 10/Assignment solutions/remove_files.py | Python | py | 668 | no_license | # 10.2 remove_files.py
# Remove JPG files from multiple folders based on file size
import os
path = "C:/Real Python/Course materials/Chapter 7/Practice files/little pics"
for currentFolder, subfolders, fileNames in os.walk(path):
for fileName in fileNames:
fullPath = os.path.join(currentFolder, fi... |
cc7514fb5fc633980957e422f84b1cf55d22966b | 8a4b8f8956ca8e0e3470b45598e80ed9c313b6d6 | baddourr/calvin-base | /calvin/csparser/calvin_rules.py | Python | py | 2,784 | permissive | # -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson 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 ... |
a76805bba2e895f4912c7dd57732e562abdc1f8b | 69dd99f58c17f7851d942280ea3c05edeb15a28e | BismarkOnRails/brasil.gov.portal | /src/brasil/gov/portal/browser/album/albuns.py | Python | py | 9,967 | no_license | # -*- coding: utf-8 -*-
from six.moves import range # noqa: I001
from plone.contentrules import PloneMessageFactory as _
from Products.CMFPlone.utils import getToolByName
from Products.Five.browser import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from zope.component import get... |
5c0cc489cc9f38777e34392956e6579822849ea3 | 5fae373af5c24d0b8f5c2f657559583413d87c9b | zhuweigh/vpx13 | /nitro-python-13.0.36/nssrc/com/citrix/netscaler/nitro/resource/config/gslb/gslbdomain_gslbservice_binding.py | Python | py | 8,360 | permissive | #
# Copyright (c) 2008-2019 Citrix Systems, 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 l... |
acfc1c8bbf22f78c1a74e73a5fb9240b04c92843 | c463eecbc4f6a94a66bdc3c27f279d3376667662 | rchamorro/pulumi-azure-nextgen | /sdk/python/pulumi_azure_nextgen/labservices/latest/get_global_user_personal_preferences.py | Python | py | 3,472 | permissive | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
142cdc4c430377879594b0b1448745718a3bcf3f | 40aae420f93d47013e164cd4490e2b0d51dd28fd | sebastian-chang/Resolve_Scripts | /sequence_batch_renderer.py | Python | py | 5,774 | no_license | import importlib.util
from PyQt5.QtWidgets import (QApplication, QWidget, QComboBox, QGroupBox, QFormLayout,
QLabel, QDialogButtonBox, QVBoxLayout, QHBoxLayout, QDialog, QSpinBox,
QFileDialog, QLineEdit, QCheckBox, QRadioButton)
from fbs_runtime.application_con... |
a80dd18f941ba9f29615c8747766b6550c1d06fb | 9e53118ce5e782faa0cef366907d21b540527829 | sud0su/django-ecommerce-api | /backend/reference/models.py | Python | py | 2,305 | permissive | from django.db import models
from django.utils.translation import gettext as _
from mptt.models import MPTTModel, TreeForeignKey
from decimal import Decimal
from django.urls import reverse
from ecommerce.path_rename import path_and_rename
# Create your models here.
class Tax(models.Model):
name = models.CharField(... |
f294e16ac1c8ffa11766971601709bf7298a5ef3 | 421be02485fbd46d50cba3032b1c337711a23f23 | kloudfuse/integrations-core | /win32_event_log/setup.py | Python | py | 2,002 | permissive | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup
HERE = path.dirname(path.abspath(__file__))
# Get version info
ABOUT = {}
with open(path.join(HER... |
c0214c0b790d5337dc822fbde923df9bb7193208 | 70ea571fdc4657fbb68ca4235b24b917e38460dd | profharris/Adafruit_Learning_System_Guides | /Adafruit_Feather_Sense/feather_sense_sensor_demo.py | Python | py | 1,947 | permissive | """Sensor demo for Adafruit Feather Sense. Prints data from each of the sensors."""
import time
import array
import math
import board
import audiobusio
import adafruit_apds9960.apds9960
import adafruit_bmp280
import adafruit_lis3mdl
import adafruit_lsm6ds.lsm6ds33
import adafruit_sht31d
i2c = board.I2C()
apds9960 = a... |
a5a48d0d10e12768e9996fc9ad26c5fcbac50080 | eeedcb43b954f2aa7777c055279104940383329f | daniel-reich/turbo-robot | /6o5wkfmSaFXCJYqDx_18.py | Python | py | 732 | no_license | """
Create a function, that will for a given `a, b, c`, do the following:
* Add `a` to itself `b` times.
* Check if the result is divisible by `c`.
### Examples
abcmath(42, 5, 10) ➞ False
# 42+42 = 84,84+84 = 168,168+168 = 336,336+336 = 672, 672+672 = 1344
# 1344 is not divisible by 10
ab... |
942697ecc12271e6943b8e0552be70c53c226b6b | 2e03910f6f063f8a89d8b5343834b380f0447ee8 | galloperx/smart-content-summary | /preprocess_utils.py | Python | py | 11,572 | permissive | # Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
8b153a1f45bdbf033b3a3470686149cef0425c42 | a2ba08206ece4dcec01734f56778b9ef3e433526 | LinguList/simuling | /simuling/simulation.py | Python | py | 1,982 | no_license | #!/usr/bin/env python
import networkx
import json
import sys
import random
from .speaker import Speaker
class LanguageForwardSimulation (object):
"""Object that encompasses the simulation.
A LanguageForwardSimulation represents a forward-time stochastic
simulation of an evolving population of speakers.... |
41a71410126c1af387fe438c68d43f0c6d25fbac | d30c3fcc7f60f6a517879cc1baeab048a030e36d | dyf102/LC-daily | /binary-search/python/kth-smallest-element-in-a-sorted-matrix.py | Python | py | 1,448 | no_license | import heapq
class Solution:
def kthSmallest(self, matrix: List[List[int]], k: int) -> int:
"""LC 378. Kth Smallest Element in a Sorted Matrix
Time complexity: O(N*N * Log(k))
"""
m = len(matrix)
n = len(matrix[0])
heap = []
for i in range(m... |
8e9c5ba0e9f9fc5c90cd6e274ef4c20e8cfa65f7 | aaa5a334870d3e61a8100549f466d3024c065cc0 | ItsNickkk/rapid-lora-netw | /webserver/rlnwebportal/main/migrations/0001_initial.py | Python | py | 1,833 | no_license | # Generated by Django 3.2.3 on 2021-05-24 06:29
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='dim_entry_status',
fields=... |
a5ed2ed2ff45c5318d76548c1730e7479b91fb5d | ba224395eeabe947a64102d48d8c3b6b6319292d | jlgao2/fastai_gcloud_deploy | /app/server.py | Python | py | 1,976 | no_license | from starlette.applications import Starlette
from starlette.responses import HTMLResponse, JSONResponse
from starlette.staticfiles import StaticFiles
from starlette.middleware.cors import CORSMiddleware
import uvicorn, aiohttp, asyncio
from io import BytesIO
from fastai import *
from fastai.vision import *
model_file... |
82f719e41bde087e2e2cd57e487b7fe22f15eef1 | 0a77afb0725a523b95f8382f0e2086a37b4dc365 | NoalGesler/Encrypted-P2P-Messenger | /Application/mockdb.py | Python | py | 1,419 | no_license | from datetime import datetime
from flask import session
class DataBase:
"""
used to connect, write to and read from a local sqlite3 database
"""
def __init__(self):
self.list_of_messages = []
self.public_key = ''
def get_all_messages(self, limit=100, name=None):
"""
... |
f058612e751c4e70bc5a176f0ad6164ad5c93a1b | 68fe760989c1fd46914388b61b9019f36f3be7df | 100ballovby/6V_Lesson | /lesson_1603/01_nested_dictionaries.py | Python | py | 448 | no_license | contacts_book = {
'mom': {
'phone': [
'+375291234567',
'+375441234567'
],
'email': 'mom@example.com',
'birth_date': '28.01.1990',
},
'father': '+375331234567',
'granny': '+375251234567',
}
# достать второй номер телефона мамы
print(contacts_book['m... |
9fcb1fbe824e6ecda8af7caeda4759dee68a6cf3 | 352b672d159f6396baf4a12aca28c3cf08f15823 | softwarelivre/segue | /segue/schedule/responses.py | Python | py | 2,246 | no_license | from segue.responses import BaseResponse
class RoomResponse(BaseResponse):
def __init__(self, room, links=True):
self.id = room.id
self.name = room.name
self.capacity = room.capacity
self.translation = room.translation
self.position = room.position
... |
ad3515a139aa97de8b2365647a7b093da143bc94 | bf936aa350a0a59e45f7abe1c148d4f2bdea81d4 | erthalion/valves-model | /src/area_builder/utils.py | Python | py | 482 | permissive | import numpy as np
def take_off_first_last(array):
rows = []
for row in array:
if np.sum(row) != 0:
row[row == True] = False
break
rows.append(row)
array = np.array(rows)
def take_one_layer_vert(array):
rows = []
for row in array[:0:]:
row = np.logi... |
5fbe691dc0a0ef7088f89cd099892517c4b811a0 | 9c81f12bed1f352057b039f604d6545986e81ac8 | VDT5702/StreetSmart | /Infer/vd.py | Python | py | 3,866 | no_license | import numpy as np
import math
class Rect:
def __init__(self, vec, position, dim):
self.vec = vec
self.position = position
self.dim = dim #0 is length
self.traffic = traffic
self.RoadAdj = []
class Infer:
def __init__(self, RectL, IMGDIM, TrafficMap):
self... |
070bfbbb8add9549778602c42d35e1b33dcaeb4d | 8c84b7ba819894c67d857da44c781a5acbf07060 | timgates42/yapf | /yapf/yapflib/logical_line.py | Python | py | 25,249 | permissive | # Copyright 2015 Google Inc. 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 law or a... |
f82b4f131076b51a85c82b5ea26aa4b384878c0a | 40563c9a406a4c4a99eef336ad3c3996babc43e0 | yoonkt200/ml-theory-python | /venv/lib/python3.8/site-packages/nbconvert/filters/tests/test_metadata.py | Python | py | 615 | permissive | from nbconvert.filters import get_metadata
def test_get_metadata():
output = {
'metadata': {
'width': 1,
'height': 2,
'image/png': {
'unconfined': True,
'height': 3,
}
}
}
assert get_metadata(output, 'nowhere') ... |
375d27b82edc9b13d1d0c56b820ca9ffdc392dc9 | 1f644ff654e352c373231b440e6acd4efeb42fb0 | abhijithmadu/Stock-Tracking-Error | /trackingapp/views.py | Python | py | 1,282 | no_license | from django.http.response import HttpResponse
from django.shortcuts import render
import requests
from decouple import config
def sample(request):
#API access key
key =config('secret_key')
params = {
'access_key': key
}
#collect sbi etf values
present_etf = requests.get('h... |
154251842e71de240cba033d21f3c7a549c4a42f | 15fd6ebbb7701fd8649859427f7b997bc8acd913 | msumanth750/skydream | /app_name/tests.py | Python | py | 2,671 | no_license | import unittest
from django.urls import reverse
from django.test import Client
from .models import SubjectModel
from django.contrib.auth.models import User
from django.contrib.auth.models import Group
from django.contrib.contenttypes.models import ContentType
def create_django_contrib_auth_models_user(**kwargs):
... |
3e69b651e49534c34ba39b06c7f9a9947cbef3a1 | 00f9abfbb995055dd9b806693759f0ef5a4e4d0b | ChaoSweeper/Intro-to-Machine-Learning | /assignments/DeepLearning/train.py | Python | py | 346 | no_license | class Train:
class KerasModel:
# TODO: Set Parameters
dense_layers = [200, 100, 50, 40, 30, 20, 10]
activation = "relu"
regularization = "l2"
batch_norm = True
weight_init = 'glorot_uniform'
batch_size = 32
optimizer = "Adam"
learning_rate = ... |
96ebeb2bfd0b7f072f3bcd80fab28a5f4c9447ad | 027fbe3922e5a1288f0c6bcace533a0e4beb8a97 | SKumarMN/DataStructuresPython | /Stack_Queue/SmartStack.py | Python | py | 401 | no_license | class SmartStack():
def __init__(self):
self.data = []
self.min=[]
def stack_push(self,item):
self.data.push(item)
if not self.min or item <= self.min[-1]:
self.min.append(item)
else:
self.min.append(self.min[-1])
def stack_pop(self):... |
20a3bb43deabc9c4a1b08ade59f95507c872c72c | fb6bb8c209a40fe449dfa2e32402e823f9231e15 | philipsales/airflow-couchbase-elasticsearch | /lib/couchBase.py | Python | py | 2,927 | permissive | import sys
import json
import time
import requests
from couchbase.bucket import Bucket
from couchbase.n1ql import N1QLQuery, N1QLError
from couchbase.exceptions import CouchbaseTransientError, CouchbaseNetworkError
from requests.exceptions import RequestException
from log.config import set_log_config, logging
logger... |
dee4db587459eb4316768f7b29b72527eba8d3ec | 4d885b73a9e02f100f17af2b7330d655937c59d6 | mojamil/SDSpring | /23_memoization/work.py | Python | py | 703 | no_license | '''
Mohammed Jamil
SoftDev2 pd6
K23 -- Memoization
2019-02-05
'''
import random
def make_HTML_heading(f):
txt=f()
def inner():
print(txt)
return '<h1>' + txt + '</h1>'
return inner
@make_HTML_heading
def greet():
greetings=['Hello','Welcome','AYO!','Hola','Bonjour','Wo... |
6fa16c7ea00cf20b2ac5ac064957ebe76d054580 | 2da7e28bd0b758f8875d64222a46631c390599ef | colin1988/tensorflow-policy-gradient | /run_vanilla_actor_critic.py | Python | py | 1,253 | permissive | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import gym
import numpy as np
import tensorflow as tf
"""
from agents.pg import PolicyGradient
from networks.nn import FullyConnectedNN
from policies.binary_mlp import BinaryMLPPolicy
from baselines.mlp import ... |
99e07ca3260cd470de045db18352111991ce2c79 | 76de9ddc2030bb4fbbe2c98bb5c148dfa04d9620 | THUMNLab/AutoGL | /autogl/solver/classifier/__init__.py | Python | py | 693 | permissive | """
Auto classifier for classification problems.
"""
from .base import BaseClassifier
from .graph_classifier import AutoGraphClassifier
from .node_classifier import AutoNodeClassifier
from .link_predictor import AutoLinkPredictor
from autogl.backend import DependentBackend
if DependentBackend.is_dgl():
from .heter... |
7a0396af568e8e4687ba7b38bee6aced29da19b5 | 3f755bf191c311b5cf92778ec00438801673897d | Dabrill/HaworthLab | /EXSAN/HBond.py | Python | py | 37,947 | no_license | import PDBTools
import BaseWaters
import KDTree
import PoseScorer
import ZMAT
import Counter
import math
import os
import multiprocessing
recorder = None
leastEnergy = -10
useCTerminalElectrostatic = False
def PRINT(string):
global recorder
print(string)
if recorder is not None:
recorder.write(strin... |
47d53190f9adc2f55fc7836e5e05587e0293ca5f | f2818b6059a6a3fd03a63ec1512e83ba6f14a0b8 | lekko/pyrailgun | /pyrailgun/actions/parser.py | Python | py | 2,532 | no_license |
__author__ = 'haku-mac'
import re
import sys
from bs4 import BeautifulSoup
from pyrailgun.actions.action import RailGunAction
if sys.version > '3':
unicode = str
class ParserAction(RailGunAction):
def action(self, task_entry, shell_groups, global_data):
rule = task_entry['rule'].strip()
... |
a0f8527fa99e8f2d5552bc3de03a98b1df52d712 | a9bfd9ac563e0bf60873707ca33346b02b4d2773 | PINTO0309/PINTO_model_zoo | /231_DRBL/demo/demo_DRBL_onnx.py | Python | py | 2,920 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
import time
import argparse
import cv2 as cv
import numpy as np
import onnxruntime
def run_inference(onnx_session, input_size, image):
# Pre process:Resize, BGR->RGB, Transpose, float32 cast
input_image = cv.resize(image, dsize=(input_size[1], input_s... |
567ba7bbf3777505d2905f36205e49d1b7b2ae86 | a91371a31cfb755ac9a471ddbeb3a302f0212e67 | pistatium/appengine_board | /main.py | Python | py | 575 | permissive | import os
import sys
import django.core.handlers.wsgi
from google.appengine.api import memcache
import settings
import django.conf
'''
= Load Django setting =
cf. http://stackoverflow.com/questions/5122414/django-googleappengine-error-django-settings-module-is-undefined
'''
settingsKeys = filter(lambda name: str(na... |
ac269b65f44b48c877ec632a9d87da5e07d8a4bb | 49780faa72be4d107071f8e381c448ca86528c4d | Anewnoob/Leetcode | /countSquares.py | Python | py | 921 | no_license | #1277. 统计全为 1 的正方形子矩阵
#给你一个 m * n 的矩阵,矩阵中的元素不是 0 就是 1,请你统计并返回其中完全由 1 组成的 正方形 子矩阵的个数。
class Solution:
def countSquares(self, matrix: List[List[int]]) -> int:
if not matrix:
return 0
H = len(matrix)
W = len(matrix[0])
cnt = 0
dp = [[0]*W for _ in range(H)]
... |
fa525755b7e9c5e65d75fceb8798891924c3d260 | 9da6f05fac130a759a4f2dbbabb0ec2eb6e9ca7f | jackiekazil/data-wrangling | /code/chp10-presentation/chart_bokeh_interactive.py | Python | py | 991 | no_license | from bokeh.plotting import ColumnDataSource, figure, show, output_file
from bokeh.models import HoverTool
# NOTE: For this chart, you will also need the 'africa_cpi_cl' table from
# Chapter 9.
TOOLS = "pan,reset,hover"
def scatter_point(chart, x, y, source, marker_type):
chart.scatter(x, y, source=source, mark... |
2972295e84272d09b9120a5a929f887e1ffe5d5c | f50c8576dd0a89c428fc653893205ec6579fa023 | kairos03/Deeplearning_exercise | /4.GAN/download_van_gogh_paints.py | Python | py | 971 | no_license | import requests
from io import open as iopen
import pandas as pd
import os
def read_url_from_csv(file_path):
csv = pd.read_csv(file_path)
csv = csv[(csv['Artist'] == 'Vincent van Gogh')]
csv = csv['ImageURL'].as_matrix()
return csv
def download_image(path, logging=False):
# set save_dir and fi... |
393ec4c8a2746d542d4a6350b90036105e437fa3 | 70e82607818bc586e9be5247b6a8cb2ed498565b | wiinew/Intelligent-Vehicle | /gps/gg.py | Python | py | 507 | permissive | import serial
import pynmea2
def parseGPS(s):
if s.find('GGA') > -1:
msg = pynmea2.parse(s)
print("Timestamp: %s -- Lat: %s %s -- Lon: %s %s -- Altitude: %s %s" % (
msg.timestamp, msg.lat, msg.lat_dir, msg.lon, msg.lon_dir, msg.altitude, msg.altitude_units))
serialPort = serial.Seria... |
c053314db58380745380c0d52451cdb1e03f1cf8 | b66349296509ef30fc118e348ebc5f21ce87f4a9 | mxrch/CrackMapExec | /cme/cli.py | Python | py | 6,008 | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import sys
from argparse import RawTextHelpFormatter
from cme.loaders.protocol_loader import protocol_loader
from cme.helpers.logger import highlight
from termcolor import colored
def gen_cli_args():
VERSION = '5.4.1'
CODENAME = "Indestructible ... |
0c01032d18a8f2cfa08b5a9463fda3faba2d6c87 | 22eb8747fe05f446ca3f581e42ff132a090a3de8 | mikeage/RallyRestToolkitForPython | /pyral/restapi.py | Python | py | 70,287 | permissive | #!/usr/local/bin/python2.7
###################################################################################################
#
# pyral.restapi - Python Rally REST API module
# round 12 incorporating support for Rally API Key
# notable dependencies:
# requests v2.0.0 or better
#
#####... |
26be13ddfd4196a8eb5e98851ffeec5485e31287 | 08743e869f13f56f779f49e09951c0e8eeba836e | miloczek/Projekty-II-UWR | /my python/Zadanie python/lista 2/duze_cyfry.py | Python | py | 1,196 | no_license | Cyfry = {}
Cyfry[0] = """
###
# #
# #
# #
###
"""
Cyfry[1] = """
#
##
#
#
###
"""
Cyfry[4] = """
#
#
#####
#
#
"""
Cyfry[2] = """
###
# #
##
#
#####
"""
Cyfry[5] = """
#####
#
####
#
####
"""
Cyfry[8] = """
###
# #
###
# #
###
"""
Cyfry[6] = """
###
#
####... |
e57a1ce7af725dd023bd5d01b60a6ff8b8e9162f | 86bac231aa8136687675c4352277b2276c2229b2 | Hughes-Genome-Group/plateScreen96 | /bin/pythonHelpers/figurerWithUnlimitedHighlight.py | Python | py | 8,377 | permissive | ##########################################################################
# Copyright 2018, Jelena Telenius (jelena.telenius@ndcls.ox.ac.uk) #
# #
# This file is part of plateScreen96 . #
# ... |
e8d45742e8bd6eb8c5710358e12d3c4a2045d703 | 7012a21f857219ddd433a015964dfab328b48356 | jart/cosmopolitan | /third_party/python/Lib/msilib/sequence.py | Python | py | 3,929 | permissive | AdminExecuteSequence = [
('InstallInitialize', None, 1500),
('InstallFinalize', None, 6600),
('InstallFiles', None, 4000),
('InstallAdminPackage', None, 3900),
('FileCost', None, 900),
('CostInitialize', None, 800),
('CostFinalize', None, 1000),
('InstallValidate', None, 1400),
]
AdminUISequence = [
('FileCost', None,... |
735d1e63fa2ad3e18e057d211282caa07f6c20d2 | 202db869fb950f8fe4fd1474136624627e76d3da | VERITAS-Observatory/V2DL3 | /pyV2DL3/VtsDataSource.py | Python | py | 1,149 | permissive | import logging
class VtsDataSource(object):
def __init__(self, source_name, evt_file, ea_file):
self.__data_source_name__ = source_name
logging.info(f"Reconstruction type:{source_name}")
self.__evt_file__ = evt_file
self.__ea_file__ = ea_file
self.__evt__ = {}
self... |
c50d7902037cc9fe5ef67282822bfbaa668accbb | 0d66dfec8db1e5566cf3c93544f8cd8b7d7b0f09 | lxj23626/CRM-System | /repository/myadmin.py | Python | py | 878 | no_license | from utils.site import site
from repository import models
from utils.base_admin import BaseMyAdmin
class CustomerAdmin(BaseMyAdmin):
list_display = ['id', 'name', 'source_type', 'contact_type', 'contact_num', 'consultant', 'consult_content', 'status', 'date']
# list_display = ['date',]
list_filter... |
2c958fe607105c3ac03f1c486d02c614b957fd18 | 461ab082fa54677e5b8638cbf926b0b6aa086b50 | Experiment5X/CryptoFunctionDetection | /crypto_implementations/virgil-crypto-c/wrappers/python/virgil_crypto_lib/foundation/_c_bridge/_vscf_key_asn1_serializer.py | Python | py | 8,592 | permissive | # Copyright (C) 2015-2020 Virgil Security, Inc.
#
# All rights reserved.
#
# 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 li... |
24c76704d53049ff147a7ff7127ce928f3d0d206 | bb5f63b658d0ff3394a50866bf74debac5679612 | justinmae/LPTHW | /Excercises/ex34.py | Python | py | 613 | no_license | # animals = ['bear', 'python', 'peacock', 'kangaroo', 'whale', 'platypus']
# The animal at 1.
# The animal at 1 is the 2nd animal and is a python.
# The 3rd animal.
# The 3rd animal is at 2 and is a peacock.
# The 1st animal.
# The 1st animal is at 0 and is a bear.
# The animal at 3.
# The animal at 3 is the 4th an... |
53d7c9be07430135b67c30d7cdcf9b645df7ec1d | 83bd46824a124b225cff0fe0b1a7c6f9e70e972d | aliyun/aliyun-openapi-python-sdk | /aliyun-python-sdk-cas/aliyunsdkcas/request/v20200407/SignRequest.py | Python | py | 2,056 | 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 u... |
5256db23a809eda46071dc2cb179f6ef45533b78 | 737221ae174faccd96828a77436fd549b51c4928 | HristoAleksiev/miles-to-kilometers | /main.py | Python | py | 847 | no_license | from tkinter import *
window = Tk()
window.title("Miles to Km.")
window.config(padx=10, pady=10)
def convert_miles_to_km():
kilos = round(float(miles_input.get()) * 1.609, 2)
in_km.config(text=kilos)
# Positioning the elements in the window through grid approach:
# Column 1
equal_to = Label(text="is equal ... |
cfef0d7e10a7d473283d1987725188074bca1e94 | af63edeef9e8925a2329d431fa36ade5f79eb0fe | Ricky-Hu5918/Python-Lab | /1287_Find_Special_Integer.py | Python | py | 2,119 | no_license | """
Given an integer array sorted in non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time.
Return that integer.
Example 1:
Input: arr = [1,2,2,6,6,6,6,7,10]
Output: 6
Constraints:
1 <= arr.length <= 10^4
0 <= arr[i] <= 10^5
"""
'''#1: 常规方法,使用count'''
def findSpecialI... |
9fa9bba63a7c7b6fdb81b0afd1bfd4b3567879c9 | 871ad36e8b7f9bcde856601da739fa03ed403332 | ryeLearnMore/LeetCode | /019_remove-nth-node-from-end-of-list.py | Python | py | 1,908 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#@author: rye
#@time: 2019/3/14
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
'''
这道题考的很简单,因为链表题刷的比较少,所以很不熟练。
tips:
1. 要自建头节点,即dumy节点,很重要
2. 指针的点要都在有效范围内,不要出去
'''
clas... |
60934179a8a3b131d03010f21b032c186677fc35 | 999664da02f4fd7f407f0e527ef6a8c3326253b7 | haku-kiro/WeatherAppPython | /weatherApp/core/parser_loader.py | Python | py | 1,057 | no_license | import os
import re
import inspect
def _get_parser_list(dirname):
"""
Returns a list of files, as long as they don't start with two
underscores.
"""
files = [f.replace('.py', '')
for f in os.listdir(dirname)
if not f.startswith('__')]
return files
def _import_parsers... |
89823f801a48f1d85286c620bad1d91063c8538e | 0881c0df5cb62b347951bebf39a5dc3ebb2b75cb | amitranjan0220/resource-tool | /my_resource/models.py | Python | py | 681 | no_license | from django.db import models
class Category(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
class MyResource(models.Model):
Unassigned = 'Unassigned'
Assigned = 'Assigned'
STATUS = [
('Unassigned','Unassigned'),
('Assigned','Assigned')
... |
2fcd376cb54e65bea87a4b38c17117270c72f7bf | bd0e0760c28929a2fc4452ef3b396d64fa6f3735 | minhdq99hp/dsa | /leetcode/1-1000/198. House Robber/main2.py | Python | py | 433 | no_license | class Solution:
def rob(self, nums: List[int]) -> int:
# dp[n-1]: max money can be robbed in n houses
# tabulation approach
n = len(nums)
dp = [-1 for i in range(n)]
dp[0] = nums[0]
if n > 1:
dp[1] = max(nums[0], nums[1])
... |
cc09250150ac06577c733b28f8e7d59ca07dde6e | f48bf7142bf73fbe2810ef16e6e53cd19dd11e8f | naseefo/mhpsbi | /fd1.py | Python | py | 431 | permissive | from mhps.isolator_osbi import fb, fbfixed, fs1, fs1fixed, fs2, fs2fixed, IsoOSBIModel
rmbm = 1.0
tbx = 50.0
zetabx = 0.0
rtytxb = 1.0
rzyzxb = 1.0
typevf = 0
mu0 = 0.1
alpha0 = 1
alpha1 = 1
nu = 1
umax = 0.85
D = 0.5
ecc = 0.4
rmrm = 0.05
tc = 100.0
ecrc = 0.0
fos_ud = 1.0
am = 1.0
niso = 4.0
iso = IsoOSBIModel(rmbm... |
5b5f6e0bcb948c599332da54c8fbf70f0089afb6 | 8e6fd6f0b7b3850176b9c0aa2626bf817ad636a3 | valdezf10/pyfly | /pyfly/pid_controller.py | Python | py | 2,083 | permissive | import numpy as np
class PIDController:
def __init__(self, dt=0.01):
self.k_p_V = 0.5
self.k_i_V = 0.1
self.k_p_phi = 1
self.k_i_phi = 0 # Note gain is set to zero for roll channel
self.k_d_phi = 0.5
self.k_p_theta = -4
self.k_i_theta = -0.75
self.... |
4a3b8a929f9efbde6af89f3c2c190b5ee2dfda2f | 6b48b346548282fd57dd65454b68d14fc37db083 | iskyd/poliastro | /tests/tests_twobody/test_orbit.py | Python | py | 38,799 | permissive | import pickle
from collections import OrderedDict
from functools import partial
from unittest import mock
import matplotlib
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import (
ITRS,
CartesianDifferential,
CartesianRepresentation,
SkyCoord,
)
from astropy.te... |
9f3e94c7e429e96f0bad410690a54bd7a935f3b2 | 91d945dca8bfc7aa577a8c0fc7d8d71d812b989c | cbc506/cloudrail-knowledge | /cloudrail/knowledge/context/aws/resources_builders/terraform/iam_group_builder.py | Python | py | 1,424 | permissive | from cloudrail.knowledge.context.aws.resources_builders.terraform.aws_terraform_builder import AwsTerraformBuilder
from cloudrail.knowledge.context.aws.resources_builders.terraform.terraform_resource_builder_helper import build_iam_group, build_policy_group_attachment, \
build_group_inline_policy, build_iam_group_m... |
1776268e2a0a9561144ed9b4d89f84f361faac70 | 3350a159f93a245bd013b3babe1b108c611a440c | KarymAidary/ecomarket_backend | /stock/migrations/0002_auto_20190218_2210.py | Python | py | 1,109 | no_license | # Generated by Django 2.1.7 on 2019-02-18 22:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('stock', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='category',
... |
7adf6b7cdb7915f75865b4fd950808491b932f97 | c02770f776373d8c66ea49422d15af278e8134f9 | AChillFeeder/python_framework | /python_framework/api/src/service/GlobalException.py | Python | py | 5,442 | permissive | import datetime
from flask import request
from flask_jwt_extended.exceptions import NoAuthorizationError, RevokedTokenError
from jwt import ExpiredSignatureError
from python_helper import Constant as c
from python_helper import log, Function, ObjectHelper
from python_framework.api.src.enumeration.HttpStatus import Http... |
ead79460e58c437f5a11fdead3239d8599ef0348 | 988373ee2980321ad9d6e45f26bb1f4a5b25e603 | PythonZero/CodeSnippets | /ABCProperties.py | Python | py | 1,211 | no_license | from abc import ABCMeta, abstractmethod
class AbstractSQLSaver(metaclass=ABCMeta):
@property
def table_name(self):
return self._table_name
@property
@abstractmethod
def _table_name(self):
pass
### Ensures that the subclass has `_table_name`:
class ConcreteSQLSaver(AbstractSQLSav... |
24fabea4adb7bce23c8e731e9fad47c15746cd33 | a049f5929de8ce6cb595973d93ab14e222331dd9 | ilatorraca/VeterinariaPatagonica | /VeterinariaPatagonica/Apps/GestionDeServicios/views.py | Python | py | 6,443 | no_license | from django.shortcuts import render
from django.template import loader
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.decorators import login_required, permission_required
from django.forms import modelformset_factory
f... |
a38e6631f982c637379e157b1906d6750296a2db | 71c8e628db06bd3a0cecb367331a327bdd49ac71 | MrShmistr/itam_python_courses | /homeworks/chapter_2/homework_2_1_2.py | Python | py | 476 | no_license | # -*- coding: utf-8 -*-
"""homework_2_1_2.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1cE-odV1ws2gHZQrEHC44OK7MRQqYobIq
"""
a = input().split()
a1, b = [], []
def summation(a):
for i in a:
i = int(i)
if i < 0:
... |
ecf8b3f99afa565ae7ff4e894c60615f133887ae | 86f6e18868ce387d6445f916561a17d622e08747 | AlexQianYi/Leetcode | /345 Reverse Vowels of a String.py | Python | py | 1,531 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 10 08:56:35 2018
@author: yiqian
"""
class Solution(object):
def reverseVowels(self, s):
"""
:type s: str
:rtype: str
"""
v="aeiouAEIOU"
m1=[]
m2=[]
n=le... |
61e2bba970b3f9353fe240ce5a36e6131a65d28c | 324a46da6be8348c691662367426b176e903b278 | loftylabs/baselinecore | /baselinecore/management/commands/install_package.py | Python | py | 715 | permissive | import os
import subprocess
import sys
from django.core.management import BaseCommand, CommandError
from django.conf import settings
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('git_url', nargs='?', type=str)
def handle(self, *args, **options):
"""
... |
59c56032e0364f84e15251cece61449ef9a67047 | 7388a7321075facb4b8157aba2eebbb0dd3a823c | wangjice/piggybacked-detection | /merge_subgraph.py | Python | py | 595 | no_license | import networkx as nx
def sng(sg, ss):
l = []
for node in sg:
if node in ss:
l.append(node)
return l
def gen_merged_subgraph(sgs, ss):
combining = True
while combining:
combining = False
len_graph = len(sgs)
for i in range(0, len_graph):
for j in range(i + 1, len_graph):
G = sgs[i]
H = sgs[... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.