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 |
|---|---|---|---|---|---|---|---|---|
6d96d040458d668359036323801c518747f7b004 | c51b364a9cec263f22d2753e481e949dced3249d | realo/machinegun | /tools/SMS/randomData.py | Python | py | 929 | permissive | import json
import random
mails = (
"mail.ru",
"inbox.ru",
"list.ru",
"bk.ru",
"ya.ru",
"yandex.com",
"yandex.ua",
"yandex.ru",
"gmail.com"
)
def random_service(list):
return random.choice(list)
def random_name():
with open("tools/SMS/names.json", 'r') a... |
62f7ca4889506b2439dd0619a39ef49db891220b | bb01125a38330508e9452ede5808fa6bb6ebdc35 | webcat-2017/agent_la | /text.py | Python | py | 750 | no_license | import pykerio
import ssl
server = "88.198.113.206"
server2 = '31.128.70.43'
ssl._create_default_https_context = ssl._create_unverified_context
api = pykerio.PyKerioControl(server=server, port=4081)
application = pykerio.structs.ApiApplication({'name': pykerio.APP_NAME, 'vendor': pykerio.APP_AUTHOR, 'version': pykerio... |
2f660a9de2551b8eed24a0801760ebd8eed5d12d | 6703031a4628f81059df2f96b9fe5e37da6b454e | hyperonecom/h1-client-python | /h1/model/iam_project_policy_create.py | Python | py | 7,321 | permissive | """
HyperOne
HyperOne API # noqa: E501
The version of the OpenAPI document: 0.1.0
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from h1.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
... |
80f5e4febab9434c57f07ed4259e8d275aaf68f2 | 49a84911e57457a2aefb11dc1fc6de86641bc338 | ThriceGood/poxbox | /models.py | Python | py | 1,198 | no_license | from peewee import *
from flask.ext.login import UserMixin
from flask.ext.bcrypt import generate_password_hash
import datetime
# using a MySQL database, peewee ORM and PyMySQL
DATABASE = MySQLDatabase("poxbox", host="localhost", user="flask", passwd="flask")
# the user model, inherits peewee's UserMixin and Model cla... |
47331ff3f82220337ca68eb4b978a9345998b65c | c468456f6f1095464398bf43fa5e24e2b0eb92a4 | bgnori/poly | /poly.py | Python | py | 4,158 | no_license |
from fractions import Fraction
import sys
class PairSeq:
"""
>>> xs = PairSeq({0:1, 1:2})
>>> xs.get_by_key(0)
1
>>> xs.get_by_key(4)
Traceback (most recent call last):
...
KeyError
>>> xs = PairSeq({0:1, 1:2, 4:4})
>>> xs.get_by_key(4)
... |
3100b7bfca86607bf884e1e97994518cf3247d1a | 5b3f0a6133f390a7439e66dd3193ed8933ba5e5a | anhstudios/swganh | /data/scripts/templates/object/tangible/ship/components/chassis/shared_ywing_longprobe_chassis_token.py | Python | py | 502 | permissive | #### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/components/chassis/shared_ywing_longprobe_chassis_token.iff"
r... |
aa058e88da3e91b87b8b7cb46f234750b8c1c861 | 8f62f70282c3e6cfce97b7b7522d28ad7f579df2 | rohanjsuresh/domainness_dataset_builder | /demo_frontend/models.py | Python | py | 2,655 | no_license | from django.db import models
from django.contrib.auth.models import User
# create table keywords( id INT NOT NULL AUTO_INCREMENT, keyword VARCHAR(512) NOT NULL, times_classified INT NOT NULL, computer_science INT NOT NULL, mathematics INT NOT NULL, physics INT NOT NULL, electrical_engineering INT NOT NULL, quantitati... |
1e400dc643caaecd2a980c9e585d6686eb272816 | 3531409bab68194e4154adef86596d8475ee2daf | Hasib1624/fvs_qin | /viz.py | Python | py | 2,949 | no_license | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
df = pd.read_csv('Result.csv')
N = np.arange(10**3, 10**4 + 1, 10**3)
mean_deg = np.arange(5, 25, 5)
# x = []
# energy = []
# time = []
# for n in N:
# x.append(n)
# values = df[df['n'] == n].iloc[:, -2:].to_numpy()
# energy.append(
#... |
06b0061dc991b75441db2652e1c2030fc025c84c | ed96aa6650b1343050cdf53253f771171b633789 | dotslash227/ailbs-website | /registration/migrations/0004_auto_20180920_1751.py | Python | py | 821 | no_license | # Generated by Django 2.1.1 on 2018-09-20 12:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0003_auto_20180920_1744'),
]
operations = [
migrations.AddField(
model_name='registration',
name='ac... |
b46991d5f7921fe2a9e2b5a6fe788630cac554ad | b2f412c3390f0bf506adf464d0eea10c326af996 | Rise-esti/Ti-asa-Django | /ti_asa/urls.py | Python | py | 1,188 | no_license | """ti_asa URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... |
e11401b5c476c2bf763a90a1ca6988cbacf6459a | f47f9a4b6ce10d298c32b96f42ec4e7bac2a4439 | aiidateam/aiida-wannier90-workflows | /src/aiida_wannier90_workflows/cli/list.py | Python | py | 8,439 | permissive | """Commands to list instances of `Wannier90BandsWorkChain`."""
import click
from aiida import orm
from aiida.cmdline.params import options as options_core
from aiida.cmdline.utils import decorators, echo
from aiida.cmdline.utils.query.calculation import CalculationQueryBuilder
from .root import cmd_root
# pylint: di... |
3c7bd5b8ef17758345b991ed314cc475b6384efe | 72184755295c360c2611a738f079b6e0c7e470f3 | guruace/Bioinfo_py_Scripts | /compare_bed.py | Python | py | 619 | no_license | #!/usr/bin/python
#!python
# Compare two bed files for sequence overlaps
import sys
BED2 = open(sys.argv[2], "r")
BED1 = open(sys.argv[1], "r")
BED2_rl = BED2.readlines()
BED1_rl = BED1.readlines()
print("\n# Overlapping Regions . . . . . . . . . . . . . . . .\n")
for line2 in BED2_rl:
BED2_tl= list(range(int(line... |
1f2b16c0283020c79abf1888a0a6a1e22ead96b4 | bf2a8f555ef4e3d70818d65718ebbd7f3706be2a | YoungandFree24/login | /login_app/views.py | Python | py | 3,370 | no_license | from django.shortcuts import render, redirect
from .models import *
# from django.http import HttpResponseRedirect, HttpResponse
from django.contrib import messages
import bcrypt
'''
renders the registration
# action method for index
'''
def index(request):
return render(request, "home_page.html")
def register... |
da5e0286a564dcd3831402a9fe979d6a976f74b1 | 6fdff918de0193e349d2e9a745cc462bae7428bf | gade-raghav/EMS | /employees/migrations/0001_initial.py | Python | py | 753 | no_license | # Generated by Django 3.1 on 2021-09-07 11:07
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Employee',
fields=[
... |
7bae2278f772f8867f4da0bf5a20ceb3ff23c9ea | 08cb5071cf6df7717d168d5eec6cc3cda60510a7 | dxcv/vnpy192 | /vnpy/trader/app/ctaStrategy/strategy/strategyKeltnerCommon.py | Python | py | 11,190 | permissive | # encoding: UTF-8
"""
DualThrust交易策略 by Leon
"""
from datetime import time
import talib
from vnpy.trader.vtObject import VtBarData
from vnpy.trader.vtConstant import EMPTY_STRING
from vnpy.trader.app.ctaStrategy.ctaTemplate import CtaTemplate, BarGenerator, ArrayManager
from sqlalchemy.sql.expression import false
... |
25ec62a644bc3f5141d525f12025b17d280fe8a5 | 7f6a77f839aedd2e08a2e8b6e3e061e7f8527d3b | yuyama137/FlaskServerForLegoProject | /detect.py | Python | py | 9,972 | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
#抽出する面積のしきい値
AREA_RATIO_THRESHOLD = 0.00005
font = cv2.FONT_HERSHEY_SIMPLEX
def calc_area(h,w,contours):
#面積を計算
areas = np.array(list(map(cv2.contourArea,contours)))
if len(areas) == 0 or np.max(areas) / (h*w) < AREA_RATIO_THRESHOLD:
#見... |
0e78bb7e448baed6c3c3a2ba54974a2969ac06f1 | 48b63b2d92664b3e0ccbc188cfcbeceaec2e6623 | mustafa-sarshar/Python-TimeSeriesAnalysis | /03_Exponential-Smoothing_and_Prediction/01_Holt_Winters_simple_exponential_smoothing(HW-SES).py | Python | py | 2,370 | no_license | """
Holt-Winter Simple Exponential Smoothing (HW-SES)
"""
# In[] Libs
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.tsa.holtwinters import SimpleExpSmoothing
# In[] Datasets
_dataset_dir = "GaitData"
_dataset_file = "02_LeftAnkle.csv"
df = pd.read_csv(f"..\\datasets\\{_dataset... |
48aa8ab8b78f411bc6b771663724958d42d3ed57 | 4b11bd2a56a8a75b6fbdae5773dfe82cc42e347c | DCC-CC4401/2019-1-Electronic-Operation-T4 | /Iteracion1/Relaciones/models.py | Python | py | 4,526 | no_license | from django.db import models
from django.contrib.auth.models import User
import json
# Create your models here.
""" Modelo de la relación Usuario_Evaluacion para la base de datos
Fields:
id_Usuario : (UUID) Identificador del evaluador
id_Evaluacion : (UUID) Identificador de la evaluación
Author:
Cl... |
d0322f11a6069cc15b924ae8b1129e6f05b0e83a | b8e9567be721901fa92450428768dacf14b17cba | GeKeShi/LSS_SGD | /src/model_ops/resnet.py | Python | py | 4,622 | no_license | '''ResNet in PyTorch.
For Pre-activation ResNet, see 'preact_resnet.py'.
Reference:
[1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
Deep Residual Learning for Image Recognition. arXiv:1512.03385
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class... |
deca65323883558cef7e357f44e9818f48937917 | 0ac98a7860fc7ffba89338eb7132240741532144 | Adarsh857/basics | /numpy stating.py | Python | py | 354 | no_license | '''import numpy as np
a=np.array([1,2,3,4])
b=np.array([9,8,7,6])
import matplotlib.pyplot as plt
plt.plot(a,b)
plt.show()'''
import numpy as np
a=np.array([1,2,3,4])
b=np.array([9,8,7,6])
import matplotlib.pyplot as plt
plt.xlabel('this is the x axis')
plt.ylabel('this is the y axis')
plt.title('this is a ... |
666ea3e3854dfed8f3f9897b1079cab9e869752a | 1a18dc533773dcb60355b87453878744ebef15ea | zplab/zplib | /zplib/datafile.py | Python | py | 7,183 | permissive | import json
import numpy
import os
import pathlib
import pickle
import tempfile
def write_delimited(path, data, delimiter='\t'):
"""Write a list of lists (or iterable of iterables) to a delimited file."""
path = pathlib.Path(path)
try:
with path.open('w') as f:
f.write('\n'.join(delimit... |
9234fe985e77c75f2f6175191f078f1870bb6b7e | 41bace26609ebc5211e4c78e2688b93203c6f887 | captainhcg/leetcode-in-py-and-go | /captainhcg/py/99-plus-one.py | Python | py | 368 | no_license | class Solution(object):
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
ret = []
add = 1
for idx in xrange(len(digits)-1, -1, -1):
add, val = divmod(digits[idx] + add, 10)
ret.append(val)
if add:
... |
49ac21d9ecc3d658a7c2207c6d867f590a5758f3 | 7fcec7d58dfc29588af5e19ad14342c9e221b114 | koushikGoswami/ERP | /purchase_requisition/migrations/0004_auto_20180515_1113.py | Python | py | 968 | no_license | # Generated by Django 2.0.3 on 2018-05-15 05:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('purchase_requisition', '0003_requisition_requisition_no'),
]
operations = [
migrations.CreateModel(
... |
458fece301b78149f3c97b48302bee3f8f808196 | 2874e386597913fe943172220e546330f4821bfe | Jae-Ro/GameAI | /Deep Q Network Coinrun/main.py | Python | py | 39,786 | no_license | ############################################################
def in_ipynb():
try:
result = get_ipython().__class__.__name__
if 'Shell' in result:
return True
else:
return False
except:
return False
IN_PYNB = in_ipynb()
#############################################################
imp... |
0eba203e21d3f3d93b7b1e7861ba289835cfbaeb | 9474e112e8cd9d04b3a5eed39d960582376f6699 | Beauy152/Vehicle-Routing | /MasterRouter.py | Python | py | 4,517 | no_license | #Intelligent Systems Project Assignment
#Authors: Daniel Nelson, Tyler Beaumont
#MasterAgent.py
import os
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
from Mapping import Map
from Artist import Artist
import pygame
import pygame.gfxdraw
from Search_Methods.PSO import PSO
from Search_Methods.ACO import ACO
from mat... |
dccd1ce9663e224bd9785e6f499d49b33718badf | 08b31c155a90c9acae26c91049a73a49bbf786c3 | JNS87/testrunner | /scripts/thanosied.py | Python | py | 24,409 | no_license | import argparse
import multiprocessing
import time
from copy import deepcopy
from multiprocessing.dummy import Pool
from couchbase.bucket import Bucket, LOCKMODE_WAIT, CouchbaseError, \
ArgumentError, NotFoundError, TimeoutError
from couchbase.cluster import Cluster, PasswordAuthenticator
from decorator import dec... |
87c217888115204b5a35583825f6698c7cb60a73 | 4882263ce6f7f475808261bb51617c4e16935da3 | pkatseas/mock-neomodel | /mock_neomodel/relationship_manager.py | Python | py | 1,651 | permissive | from neomodel.exception import DoesNotExist
class FakeRelation(object):
def __init__(self, origin):
self.origin = origin
self.connections = {}
def __bool__(self):
return len(self.connections) > 0
def __nonzero__(self):
return len(self.connections) > 0
def search(self... |
af3514b102303f6f7898c538453194b725130fbd | 223c916c93983dde3d56bd6c19dad1e1705d39b1 | Krishvrutti/leetcode | /1197 Minimum Knight Moves/soln.py | Python | py | 1,207 | no_license | # Link to video: https://youtu.be/4SjxUqG2WZU
class Solution:
def minKnightMoves(self, x: int, y: int) -> int:
steps = [(2, -1), (1, -2), (-1, -2), (-2, -1), (-1, 2), (1, 2), (2, 1), (-2, 1)]
seen = set()
q = [(0, [0, 0])]
while q:
moves, coord... |
51f026c899383ead31b60c9d7ad8e96115543c09 | bd5a9f157b535db60ef04e7fc5e746d3d7af74b9 | CraigBryan/pellinglab_twitter_microscope | /src/production_files/receivers/twitter_receiver.py | Python | py | 13,209 | permissive | '''
Created on Sep 6, 2013
@author: Craig Bryan
'''
from receiver import Receiver
from collections import deque
import twitter
import time
from production_files import utils
class TwitterReceiver(Receiver):
"""
A receiver that pulls from and posts to Twitter
Attributes:
router: A referen... |
9fbd3f2a4dca2553f2d326646a6101ae16ecaa3d | 44f97947a24e8d97d1baa9235cf4cd16ae734039 | ak2000-kartheek/MAJOR-PROJECT--Drinking-Water-Quality-Detection-Using-Machine-Learning-Techniques. | /qualfactors.py | Python | py | 4,595 | no_license | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'qualfactors.ui'
#
# Created by: PyQt5 UI code generator 5.12.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):... |
becd258be7c6ba1ee01df212f61d66cb2e82f50c | 71709dea40e61ef0b4a2167f4e62315d87874108 | bridgecrewio/checkov | /tests/dockerfile/checks/test_RunUsingAPT.py | Python | py | 1,193 | permissive | import os
import unittest
from checkov.dockerfile.checks.RunUsingAPT import check
from checkov.dockerfile.runner import Runner
from checkov.runner_filter import RunnerFilter
class TestRunUsingAPT(unittest.TestCase):
def test(self):
runner = Runner()
current_dir = os.path.dirname(os.path.realpath(... |
942c6c4818b771489e7650157c42a9421604b949 | 9a890142576416e74cf1ace71704fb3781b3a810 | dedicatted/kubehub-backend | /kubehub/proxmox/vm_migrate.py | Python | py | 1,455 | no_license | from ..proxmox.proxmox_auth import proxmox_auth
from ..proxmox.get_vm_node import get_vm_node
from ..proxmox.get_less_busy_node import get_less_busy_node
from ..proxmox.get_task_status import get_task_status
def vm_migrate(host, password, vmid):
proxmox = proxmox_auth(
host=host,
password=password... |
33326d1c0d991455eabf37f856158098460cf012 | 661b36cca9720dadce1607f17b261a829f3ed511 | ThanHuuTuan/Project-Dashboard-with-Django | /app/user/api/urls.py | Python | py | 504 | permissive | from django.urls import path
from user.api import views
app_name = "api-user"
urlpatterns = [
path("create/", views.CreateUserView.as_view(), name="create"),
path("authenticate/", views.CreateTokenView.as_view(), name="authenticate"),
path("my-profile/", views.ManageUserView.as_view(), name="my-profile")... |
25a71d4dbdd32e968b7384a327a3db38d7706772 | 20420ef24204446c9b0e09917968c737e5d0af66 | otus-devops-2019-02/devopscourses_infra | /venv/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pgsnap.py | Python | py | 7,877 | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Simon Dodsley (simon@purestorage.com)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',... |
878eb9816d77d9bcf694b34d2d3cbf868f355fed | fdeb0ecf0e9af29201f4d8ab95dc1634f7e23783 | gideonbros/polyaxon | /core/polyaxon/cli/components/clean_ops.py | Python | py | 2,473 | permissive | #!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... |
02da1e47c52f4b7aec322761b28e258b9812c73e | 2357e26c497f29eb644df018ff5b34918344cbdc | johnjasa/dymos | /dymos/examples/brachistochrone/test/test_brachistochrone_solve_segments.py | Python | py | 19,943 | permissive | import unittest
import warnings
import openmdao.api as om
from openmdao.utils.assert_utils import assert_near_equal
import dymos as dm
import dymos.examples.brachistochrone.test.ex_brachistochrone_vector_states as ex_brachistochrone_vs
from dymos.examples.brachistochrone.brachistochrone_ode import BrachistochroneODE
... |
c254e07bdb8d998c21f46754158842c7fb371e2a | 8af4969f32783ea3fc74bbb4dcedc2087ca63f22 | Nawod/python-aiplatform | /samples/snippets/prediction_service/cyber_ai_v2.py | Python | py | 6,205 | permissive | from typing import Dict, List
from google.cloud import aiplatform
import numpy as np
import pandas as pd
from elasticsearch import Elasticsearch
from elasticsearch import helpers
import json
import time
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence impor... |
b830138edc7b866117fafe1d2d17519d4999353d | 787f026283048c7b1d9df09871d3519ec0ff89ca | ljzjohnson/manila | /manila/tests/share/drivers/container/test_driver.py | Python | py | 13,882 | permissive | # Copyright 2016 Mirantis, 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 b... |
42644c52671e6373c2a58b9dde2744b6e962abff | b910f22d3e81060a71be86bd9742dc390864309a | mehrdadn/ray | /python/ray/tests/test_component_failures_3.py | Python | py | 4,202 | permissive | import os
import sys
import time
import numpy as np
import pytest
import ray
import ray.ray_constants as ray_constants
from ray.test_utils import get_other_nodes
@pytest.mark.parametrize(
"ray_start_cluster", [{
"num_cpus": 4,
"num_nodes": 3,
"do_init": True
}],
indirect=True)
de... |
55422adad24914b887b29f523d981fa013c15c9f | d94abe13372393703039777518582f97a233b31d | radupasparuga/algo-viewer | /algoViewer/sort/algo_switcher.py | Python | py | 989 | no_license | from algoViewer.sort.bubble_sort import BubbleSort
from algoViewer.sort.insertion_sort import InsertionSort
from algoViewer.sort.merge_sort import MergeSort
from algoViewer.sort.quick_sort import QuickSort
from algoViewer.sort.radix_sort import RadixSort
from algoViewer.sort.selection_sort import SelectionSort
bubble ... |
a1cc633af254d9642904cb2e8e74761e93c23922 | 286350614ae68d8bacfb9c5c8c6eff431bbfd12d | secveer/ace2-gui | /backend/app/db/schemas/node_directive.py | Python | py | 387 | permissive | from sqlalchemy import func, Column, String
from sqlalchemy.dialects.postgresql import UUID
from db.database import Base
class NodeDirective(Base):
__tablename__ = "node_directive"
uuid = Column(UUID(as_uuid=True), primary_key=True, server_default=func.gen_random_uuid())
description = Column(String)
... |
3b086236a8e6280318721f7a25f855b3b6a269cb | 9c9b14503205388607b919180142d74aa5b5e10c | coleridge72/quick_thoughts | /model.py | Python | py | 3,104 | no_license | """Main Quick thoughts model definition, uses transformer network with shared weights."""
from tensor2tensor.models import transformer
import tensorflow as tf
import numpy as np
FLAGS = tf.flags.FLAGS
class QuickThoughtsModel(object):
"""Encodes sentences into distributed vectors, predicts context sentences from... |
c820cf103f989dedb3bf7b952fc45db54420009f | 1e2d82eba25c6d1c630b9f989c7d141aa3599f5a | ShinHyoHaeng/Learn-Python | /Ch12_Window-Program/12-09-fav-animal.py | Python | py | 2,581 | no_license |
## 좋아하는 동물 투표 프로그램
from tkinter import *
window = Tk()
window.geometry("400x400")
window.title("좋아하는 동물 투표")
# 함수 정의 부분
# var 변수의 값에 따라 윈도우 하단 이미지라벨 영역의 이미지 변경
def myFunc() :
if var.get() == 1 :
labelImage.configure(image=photo1)
elif var.get() == 2 :
labelImage.configure(image=photo2)
el... |
6de243d4b56f45337b04e3a96fb4e11cd851ef6d | 6a5e4b5ceba94c9d9d202ab87370273d31ec045c | sirayhancse/FastAPI-Demo | /app/config.py | Python | py | 409 | permissive | import os
from pydantic import BaseSettings
class Settings(BaseSettings):
class Config:
env_file = ".env"
app_name: str = "FastAPI Demo"
admin_email: str = "sirayhancs@gmail.com"
secret_key: str = os.getenv("SECRET_KEY")
hash_algo: str = os.getenv("HASH_ALGO", "HS256")
access_tok... |
24dead7efa5ab3284727a62bd72f90640a804cd7 | ebc72573e314b8142f036c291362dc9310d9deb0 | Tiltmeka/RIP | /lab2/lab_python_oop/circle.py | Python | py | 330 | no_license | from lab_python_oop.ac import GF
from math import pi
class Circle(GF):
def __init__(self, radius, color):
self.radius = radius
self.color = color
def area(self):
return self.radius * self.radius * pi
def __str__(self):
return f"{self.color} colored circle with {self.radius... |
fc5f7e70bde998841eb5dc53c0181cef54006e97 | 7ca8e9866560ade5f5b9c148c2baf36635a37118 | Warriorchief/PalindromeRearrangement | /PalindromeRearrangement.py | Python | py | 783 | no_license | def palindromeRearranging(inputString):
w=''.join(sorted(inputString))
if w==inputString and len(w)%2==1: #edge case:string consists of only one unique character
return True
if len(w)%2==0:
for char in w:
if w.count(char)%2!=0:
return False
return T... |
a187819b4794a99796d47b985109e4e0682bcb41 | 1c63d29393cf5264ae91dab7028c86eadb9e91a4 | mokeyDluff/SpeedBump_detection_usingCV | /research/object_detection/builders/dataset_builder.py | Python | py | 6,073 | permissive | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
3017388acf8f71c08adfcdbc7d3cc4fe0d319afb | 15256ee089ebb6e0dd903b6624c840c08ade30ec | tonal/natasha | /natasha/tests/test_address.py | Python | py | 5,261 | permissive | # coding: utf-8
from __future__ import unicode_literals
import pytest
from natasha import AddressExtractor
from natasha.grammars.address import (
Address, Index, Country,
Region, Settlement,
Street, Building, Room
)
@pytest.fixture(scope='module')
def extractor():
return AddressExtractor()
tests = ... |
db67b06d2a839877a02c09bf42440cba712a1bdb | 8cb027530fd27aa32ad2fbf7bcf676ff14e3d2de | Malixa/projet-reseau | /Src/Client/System/server.py | Python | py | 2,001 | no_license | """
Ce module contient :
La classe serveur : gere toute la connexion et l'echange avec le serveur
"""
import socket
from . import packetfactory as packetfactory
class Server(object):
"""
Le serveur represente le serveur de jeu cote client
"""
Instance = None
@staticmethod
def start():... |
c948958a079cd41eaa45fb036df27715d110d583 | 3135c5379e8805a3dab06f8881b85766fb20ec47 | jiweibo/Paddle | /python/paddle/distributed/fleet/meta_parallel/pipeline_parallel.py | Python | py | 14,233 | permissive | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
6ab598a2bc4be003ed8f3b3544e1f40ffec13672 | be2f19209badb7d29d88004a096db218b6a06ee5 | yaowuya/python-study | /4-函数式编程/1-高阶函数map-reduce.py | Python | py | 2,972 | no_license | '''
Python内建了map()和reduce()函数。
map()函数接收两个参数,一个是函数,一个是Iterable,
map将传入的函数依次作用到序列的每个元素,并把结果作为新的Iterator返回。
'''
def f(x):
return x * x
r = map(f, [1, 2, 3, 4, 5, 6, 7, 8, 9])
print(list(r))
'''
map()传入的第一个参数是f,即函数对象本身。由于结果r是一个Iterator,
Iterator是惰性序列,
因此通过list()函数让它把整个序列都计算出来并返回一个list。
'''
print(list(map(str, [1,... |
78a338ce29687b2bfcbee4575b9fb22686b5989b | c7db38cef20d5249c0b96c024a88a80d03441f9d | danrneal/problems-vs-algorithms | /dutch_national_flag_problem.py | Python | py | 1,366 | permissive | """Sort an array of 0s, 1s, and 2s in place.
Usage: dutch_national_flag_problem.py
"""
def main():
"""Main function call to test the rearrange_digits function."""
list_1 = [0, 0, 2, 2, 2, 1, 1, 1, 2, 0, 2]
assert sort_012(list_1) == sorted(list_1)
list_2 = [2, 1, 2, 0, 0, 2, 1, 0, 1, 0, 0, 2, 2, 2, ... |
700181c1304732ed60d126b4d7d7aec1f3b7f48d | e7bd90c34eeeb3a9d7699e75bc2dd6f6e7a3134c | ghurson/h | /tests/h/routes_test.py | Python | py | 7,191 | permissive | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from mock import Mock, call
from h.routes import includeme
def test_includeme():
config = Mock(spec_set=['add_route'])
includeme(config)
# This may look like a ridiculous test, but the cost of keeping it
# up-to-date is hopefully pre... |
9e4828abb7edeea936449ddf73a480a6cf95dc87 | 1dbb71b6e5d371ddd1eaf06b7b191bd84c06dfc1 | gogobody/ppm | /model_wpaxos.py | Python | py | 14,956 | no_license | import numpy as np
import math
import model
import time
# Modeling WPaxos
# in each round, we have 4 possibilities:
# (1) run phase 2 locally
# (2) forward to another local node and run phase 2
# (3) forward to remote node and run phase 2
# (4) run phase 1 followed by phase 2
def compute_node_shares(cols, ... |
ca4d63a6d285c550f72d4e59ed43d6fe7ccd307d | 6943a48882dcc4963e5479d84c576c92403d80fe | Spectrumcash/Spectrum-ElectrumX-Client | /electrum_spectrumcash/gui/kivy/uix/dialogs/password_dialog.py | Python | py | 4,226 | permissive | from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from decimal import Decimal
from kivy.clock import Clock
from electrum_spectrumcash.util import InvalidPassword
from electrum_spectrumcash.gui.kivy.i18n import _
Builder.load_string('''
... |
e8e084b72667bae7902122f69340d14d3ba8a6df | d8787dea6a46b351f83eec8c3387774e22a62607 | asromafan/0831 | /list01.py | Python | py | 705 | no_license | string1 = "This is a "
string2 = "short string."
sentence = string1 + string2
print("()".format(sentence))
print("{}{}{}".format("She is"," very"*4," beautiful."))
m = len(sentence)
print("{}".format(m))
string1 = "My deliveralbe is due in May"
string1_list1 = string1.split()
string1_list2 = string1.split(" ",... |
60e6156f1c524329342a283efeda45eab277d00e | 36bd26e45b62c28519a6d9437ab25f8e517d499e | jerumanu/-constan-API | /virtual/Scripts/django-admin.py | Python | py | 698 | no_license | #!c:\users\hp\documents\constant-api\virtual\scripts\python.exe
# When the django-admin.py deprecation ends, remove this script.
import warnings
from django.core import management
try:
from django.utils.deprecation import RemovedInDjango40Warning
except ImportError:
raise ImportError(
'django-admin.py... |
2675a19b9c5770208a68ddaabffead36e1711f93 | b3a7f36683807ef4ce4c7f6238e78b5422ce3f3d | shamsiit/monitor_app_blueprint | /app/module_net/net.py | Python | py | 17,249 | no_license | import pprint
import json
from flask import Flask
from flask import request,jsonify,abort,render_template
import collections
import json
from random import randint
import threading
import time
from flask import g
from influxdb import DataFrameClient
import json
import dateutil.parser as parser
import time
from datetim... |
285bfcd3a6cc3de1db5b5dc245bb65ff1cbe6dd2 | 19788233d5785174462a891e87f4b6321acf2760 | Pexeso/CWR-DataApi | /cwr/info.py | Python | py | 3,417 | permissive | # -*- coding: utf-8 -*-
from cwr.record import TransactionRecord
"""
CWR information model.
"""
__author__ = 'Benardo Martínez Garrido'
__license__ = 'MIT'
__status__ = 'Development'
class AdditionalRelatedInfoRecord(TransactionRecord):
"""
Represents a CWR Additional Related Info (ARI).
This record ma... |
06e16cc116005d83607b6a833903950a130fc980 | 8a0c2e143010295efcb6ec7c56e2cc25744ffa98 | hanesi/GoPractice | /Leetcode30DayChallenge/LeetCodeProblems/ValidPalindrome/validPalindrome.py | Python | py | 543 | no_license | """
Given a string, determine if it is a palindrome,
considering only alphanumeric characters and ignoring cases.
Note: For the purpose of this problem, we
define empty string as valid palindrome.
Example 1:
Input: "A man, a plan, a canal: Panama"
Output: true
"""
import re
class Solution:
def isPalindrome(sel... |
0d1a82536db3f554d89552c081fa14f226f516e2 | 5f0e50c00477f8a7edd61a3d198d299dd96a805d | Rustymooz/NTC | /NEW/main.py | Python | py | 3,744 | no_license | from tkinter import *
import os
# To reload imports
import importlib
from tkinter import ttk
import GUI
import Classify
class Main:
def __init__(self, frame):
# Criar um style para modificar as cores da treeview
s = ttk.Style(frame)
s.theme_use("clam")
# Create Project Frame
... |
c64d7cc8485f6d3eeeb5a93bdb2aed6d69d78d53 | a864d5152990d90e6074b704e2faba85f8bb608f | Bob-Thomas/mptt-bot | /main.py | Python | py | 2,432 | no_license | import sqlite3
import os
import io
import shutil
from time import strftime, time
from datetime import datetime
from flask import Flask, render_template, g
from apscheduler.schedulers.blocking import BlockingScheduler
from subprocess import call
import threading
import atexit
from modules import kik, database
import con... |
6eccfbe9c55b878de1859dfd7b9af948a4f6e630 | 68ae9585fd0a5114db486313d725ea316d98f627 | pwentrys/etl_system_base | /helpers/sql/mysql/functions.py | Python | py | 1,921 | permissive | __author__ = 'Przemyslaw "Blasto" Wentrys'
from helpers.simplifiers.functions import Simplify
class MySQL_Functions():
def __init__(self):
pass
def check_for_existence(self, database, table, columns):
return 'select {2} from `{0}`.`{1}`;'.format(database, table, columns)
def get_schema... |
50130c51126dbe282032840fd9e6bb83550d2347 | 3013ce997537ac4b54177616db56c79688aed92a | 8secz-johndpope/bdScripts | /staramba/applyAutorig.py | Python | py | 474 | no_license | import autorig.tsgs.legSetup as legs
import autorig.biped_rig as bp
import autorig.tsgs.tongueSetup as t
import autorig.tsgs.jawSetup as j
import autorig.utils.rename_head_bs_attr as rbs
reload(bp)
reload(rbs)
reload(legs)
name='popefrancis'
root_joint = 'root_jnt'
bsDir = 'c:\\repo\\StarIsland_content\\07_Pope\\02_M... |
54677dc328b04e8e1165fc38bc0a945748280123 | 3b9348754ac37f4eef7246c8b16244f8f1c11ddb | StarStudyStart/rest_framework | /turtorial/snippets/serializers.py | Python | py | 1,457 | no_license | #!/usr/bin/env python
# coding:utf-8
"""
Author : yabinli
Time : 2020/5/7 0007 22:03
"""
from rest_framework import serializers
from snippets.models import Snippet, LANGUAGE_CHOICES, STYLE_CHOICES
class SnippetSerializer(serializers.Serializer):
id = serializers.IntegerField(read_only=True)
title = serial... |
6ba0aa0bc729f6c4fff907f869e0474641e67759 | 2ab86dc93625cf8862a5ecd4968f83a58ca9555a | kobeding/python | /2015/reference.py | Python | py | 735 | no_license | #!/usr/bin/python
# Filename: reference.py
print('Simple Assignment')
shoplist = ['apple', 'mango', 'carrot', 'banana']
mylist = shoplist # mylist is just another name pointing to the same object!
del shoplist[0] # I purchased the first item, so I remove it from the list
print('shoplist is', shoplist)
prin... |
d492ea285a614c3eedb185aa583fb645bd8c96ba | cda7d55cbaefebceab046808644cf5c254cfa6a7 | liaosiwei/guagua | /taobao/top/api/rest/SimbaCustomersAuthorizedGetRequest.py | Python | py | 312 | no_license | '''
Created by auto_sdk on 2013-04-14 16:35:32
'''
from top.api.base import RestApi
class SimbaCustomersAuthorizedGetRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
def getapiname(self):
return 'taobao.simba.customers.authorized.get'
|
d3027ccfdffe3649922071037ec5d346a78da6cc | 544d15c396798a6dcc7ded423c2e5dd2b2a9a1ab | nyroro/leetcode | /LC303.py | Python | py | 624 | no_license | import copy
class NumArray(object):
def __init__(self, nums):
"""
:type nums: List[int]
"""
self.sums = copy.copy(nums)
tmp = 0
for i in xrange(len(self.sums)):
self.sums[i]+=tmp
tmp = self.sums[i]
def sumRange(self, i, j):
... |
d51fb2982e48f2a5e7b6f17b775ae8025118f0e9 | b080ce1822348b9585659898f0cf747b8ce6505f | 5l1v3r1/NeuroRobot | /Software/Python/ML/Hand_Detection/cloud/google-cloud-sdk/lib/surface/spanner/databases/get_iam_policy.py | Python | py | 1,623 | permissive | # Copyright 2016 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 ag... |
10a39e7f9e1a635e4b0ee3292a6511a1e7bb8162 | c236fa3b510c83abe3b9d0e4f71a6875dd95c46a | kavyareddyp/Assignments | /pyassign/assign14.py | Python | py | 275 | no_license | """
14. take a string from the user and check contains atleast one capital letter or not?
"""
s=raw_input("Enter a string:")
for i in s:
if i==i.capitalize():
print "string contains capital letters"
break
else:
print "string does not capital letters"
|
c892e6dfc1d41fb482b41297c643bdcddcbda603 | be93359908f3638d0daa577183fe57a6049bb972 | Kjell-Nina/my_first_python_proyect | /Proyectos_basicos_de_python/converso.py | Python | py | 712 | no_license |
def conversor(tipo_moneda,valor_dolar):
moneda = input('¿Cuantos '+ tipo_moneda +' tines?: ')
moneda = float(moneda)
#valor_dolar = 4.025 se quita por que ya se invoca en la parte de función
dolares = moneda / valor_dolar
dolares = round(dolares,2)
dolares = str(dolares)
print('Tienes $'+ d... |
f2213d0376a84fbfe747fae691db38248f737478 | a67645143344dd52d863fc965ed42212c6ef7a24 | vanrossumlab/ap_msc | /temp2.py | Python | py | 17,503 | no_license | import numpy as np
import matplotlib.pyplot as plt
import imageio
import os
from components import DataManager as dm
def mov_mean(x, N):
r = np.convolve(x, np.ones((N,))/N)[(N-1):]
r[-1] = x[-1]
for i in range(0, int(np.ceil(N))):
r[-i] = x[-i]
return r
def RGB(R, G, B):
return (R/255, G/2... |
8615e1676ce2418f37b9941226436fa8ce055eca | 9a42c43d6697c3073dc05be2cac2fdddd7f88e1b | phgupta/XBOS | /dashboards/xbosdash/xsg.py | Python | py | 3,748 | permissive | import datetime
import pendulum
import pytz
import numpy as np
import pandas as pd
import toml
from xbos_services_getter import xbos_services_getter as xsg
config = toml.load(open('config.toml'))
ADDRESS=config['Microservices']['url']
price_stub = xsg.get_price_stub(ADDRESS)
optimizer_stub = xsg.get_optimizer_stub(A... |
82861edd3ec36d1c547c19fa39834ec37a83dcb0 | b118bcdd8c6582a62e4093b01955bb17ff5faba1 | CIGIHub/opencanada | /articles/migrations/0063_auto_20150930_1924.py | Python | py | 428 | permissive | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0062_auto_20150930_1633'),
]
operations = [
migrations.RemoveField(
model_name='citation',
... |
cafa8fc672440a3ad51ca09489738e43c334d61d | 588decc5b5126d38d12ed305572923f4d9f634ef | yuanhuiru/xnr2 | /xnr_0429/xnr/cron/xnr_operate/cron_compute_hot.py | Python | py | 6,077 | no_license | # -*-coding:utf-8-*-
import os
import json
import time
from save_utils import save_content_recommendation_results,save_subopnion_results
# 引入内容推荐分类器
#from content_recommend.process_summary import summary_main
# 引入子观点分析分类器
import sys
sys.path.append('/home/xnr1/xnr_0429/xnr/cron/xnr_operate/sub_opinio... |
a19247461da612f4272e7f1b2ae210c47615f18f | f7702df1e083f8ec05b0eebc3af8309abffa07fd | codenotes/kinetic_aborted | /site-packages_from_working_windows_python/move_base_msgs/msg/_MoveBaseGoal.py | Python | py | 8,045 | no_license | # This Python file uses the following encoding: utf-8
"""autogenerated by genpy from move_base_msgs/MoveBaseGoal.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import geometry_msgs.msg
import std_msgs.msg
class MoveBaseGoal(genpy.Message):
_md5sum... |
8c3d60f82b1a6f9aa38f649c6c5d686a207b6ab5 | 86c2d7032ffe4498d9d6586ae9f118d5d896c44d | gaybro8777/discord-fireworks | /fireworks/text_firework.py | Python | py | 2,289 | permissive | import os
from random import expovariate, uniform, gauss
from lepton import Particle, ParticleGroup, default_system, domain
from lepton.controller import Lifetime, Movement, Fader, ColorBlender
from lepton.emitter import StaticEmitter, PerParticleEmitter
from lepton.renderer import PointRenderer
from lepton.texturizer ... |
2c31a4b3aa51372d80c0a1c143516dd9a6f9a708 | 68a24c35ffdf65bfa3e122a7a6c7cd7823015605 | ycchanau/FYP-Seg | /models/mobilenetv3.py | Python | py | 13,223 | no_license | from base import BaseModel
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
class _Hswish(nn.Module):
def __init__(self, inplace=True):
super(_Hswish, self).__init__()
self.relu6 = nn.ReLU6(inplace)
def forward(self, x):
return x * self.relu6... |
c1fe2e958e58ef49727602c2b467dbe3f708e0a9 | 1ff22507a6482a8a8a0d249b7717725917f2c9c9 | zhihao-lu/horb | /bot.py | Python | py | 1,034 | no_license | import os
from telegram.ext import Updater, CommandHandler
t = Test()
def callback_alarm(context):
job = context.job
a = t.check()
if a:
context.bot.send_message(job.context, text=a)
def reminder(update,context):
update.message.reply_text(text='Daily reminder has been set! You\'ll get noti... |
1daac5ea4c4f20864aa8428150ab068170ab158f | 9b06b62eee77f34c903742e53a08a78916aae5e7 | stjordanis/prometeo | /experimental/experimental_examples/blas_interface.py | Python | py | 507 | permissive | from prometeo import *
n: dims = 10
A: pmat = pmat(n, n)
for i in range(n):
for j in range(n):
A[i,j] = i*n + j
B: pmat = pmat(n, n)
for i in range(n):
for j in range(n):
B[i,j] = 0.0
for i in range(n):
B[i,i] = 1.0
C: pmat = pmat(n, n)
for i in range(n):
for j in range(n):
... |
f68a9091298e35b3ce0f8016b565d7bf66f23cb8 | fb1f4b47ac5a7c41d4568e9c75ef8201c042e3db | jonathancg90/appSpiral | /spiral/apps/sp/forms/Brand.py | Python | py | 1,415 | no_license | from django import forms
from apps.sp.models.Brand import Brand
from apps.sp.models.Entry import Entry
from crispy_forms.helper import FormHelper
from django.utils.translation import ugettext_lazy as _
class BrandForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.helper = FormHelper()
... |
c7f08df5eec28b2be11c3f0f9ad8391c4c8ea962 | fdeaa17f354df1d2bd4d569623f6bfdc41e00efd | jsk-choi/FileReorgAndContactSheet | /ThumbSheet/Main.py | Python | py | 1,070 | no_license | import os
import sys
import cv2
import collections
import numpy as np
from PIL import Image, ImageDraw, ImageFont
sys.path.append("..{0}FileReorg".format(os.path.sep))
from ClassFileInfo import *
import Capture as cap
import Config as conf
import FileSystem as fs
import Functions as fn
import Image... |
5b71105e2ef99d40123f5d908f5d0c5e07c02135 | 63760dd4670bbd36f67ce606c946d3090652ffe3 | coecms/coecms-util | /test/test_dimension.py | Python | py | 2,131 | permissive | #!/usr/bin/env python
# Copyright 2018 ARC Centre of Excellence for Climate Extremes
# author: Scott Wales <scott.wales@unimelb.edu.au>
#
# 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
#
# ... |
4051d3095a3100b2c6af3f025df679788cf36a91 | f101348514e0930e56473aeab1f5b65551feda7b | alexeev509/Neural_networks | /python/course/stepik/TaskFromStepikInheritance2.py | Python | py | 953 | no_license | import time
class Loggable:
def log(self, msg):
print(str(time.ctime()) + ": " + str(msg))
class LoggableList(list, Loggable):
def append(self, element):
self.log(element)
super(LoggableList, self).append(element)
a = LoggableList()
a.append(5)
print(a)
class ExtendedStack(list):... |
9f0d52e87bc13ed807b80bbf16022dd577dbc840 | 76815d209834e6024d84cb6a54d60ffc3747bb5a | zimmermanc/esp-sdk-python | /esp_sdk/models/custom_signature_result_alert.py | Python | py | 12,517 | permissive | # coding: utf-8
"""
ESP Documentation
The Evident Security Platform API (version 2.0) is designed to allow users granular control over their Amazon Web Service security experience by allowing them to review alerts, monitor signatures, and create custom signatures.
OpenAPI spec version: v2_sdk
Ge... |
487985b847b53bb503446a4da7fdce8952df6c9f | aa579d3080f18e75456d23d91cf92f9d108d68a1 | mrgenisoft/JimMessenger | /client_log.py | Python | py | 902 | no_license | # This Python file uses the following encoding: utf-8
import sys
import logging
from functools import wraps
from random import randint
def func_log(func):
@wraps(func)
def log_wrap(*args, **kwargs):
res = func(*args, **kwargs)
logger = logging.getLogger(logger_name)
logger.debug(f"{f... |
7022fc50600cd4045dffa142167d389e45695d8f | 665d764b6bace4ecc2eea007ea238524d5d17697 | airrain/Algorithm-questions-and-answers | /algorithm-questions-python/GetKNumsRand.py | Python | py | 961 | no_license | """有一个机器按自然数序列的方式吐出球(1,2,3……),你有一个袋子,袋子最多只能装下K个球。
设计一种选择方式,当吐到第N号球时,之前每个球被装进袋子的概率都是 k/N。
"""
import random
class ReservoirSampling(object):
def __init__(self,bagSize):
self.bagSize = bagSize
self.bag = [None] * bagSize
def rand(self,max1):
return int(random.random() * max1 + 1)
def add(self,num):
if num <... |
52f2a214dc944184cd05d6454264fb7101392d00 | c0fffa77e73a6766d6c5395a6616f1e2275f7b1c | youkidearitai/Arduino_LED_on_Python | /section3/on_off.py | Python | py | 386 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class OnOff(object):
def __init__(self):
self.count = 0
def push(self, line):
result = False
message = "off"
if (self.count % 2 == 0):
result = True
message = "on"
self.count = self.count + 1
... |
7a4e7336ed25f6ca8e22d4bee0840f44075d16ab | 6c987db7d9fd3e587bcaf95d6f6c25afb9405f36 | rachel-schwitzgebel/covid | /scripts/generate_submission_file_cumulative.py | Python | py | 3,342 | permissive |
import covid.util as util
import covid.models.SEIRD_incident as model_type
import pandas as pd
import matplotlib.pyplot as plt
import sys
forecast_date = pd.to_datetime(sys.argv[1])
samples_directory = sys.argv[2]
import numpy as np
from epiweeks import Week, Year
num_weeks = 8
data = util.load_state_data()
place... |
4d87107e4075550c99868e40c11837fdbdbccdee | 6f1a5320c022c87085ac9d4ef28162e4935d58e0 | romeo09/DeploymentTest1 | /Deployment/wsgi.py | Python | py | 398 | no_license | """
WSGI config for Deployment 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/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... |
018c5fac8ca47936622840a31315229b8560c038 | 8387819668d3c477fb2ee31e41e6b3eba4d9065b | glongoni/MiniRedis | /MiniRedis/ElementBucket.py | Python | py | 1,796 | no_license | from Element import Element
#Linked list implementation, each ElementBucket can contain N elements sharing
#the same index in the hash table. Those lists are supose to be small, so it
#shouldn't be a performance issue
class ElementBucket:
def __init__(self, element):
self.__element = element
se... |
9df37f5d352d84acc5cc5c365d4505f5aa31a448 | 69b3af306d199c13248dd2b2eedec71830c534e2 | hoffmann/sqlalchemy | /lib/sqlalchemy/sql/schema.py | Python | py | 135,186 | permissive | # sql/schema.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""The schema module provides the building blocks for database metadata.
Each element... |
284dbf5e73ecf895366a14d3be1d0d29887eaa6e | ebe05dff52393048f9ef5cd7cde689fcc6fa2608 | eksamindefv2/eksav2 | /penilaian/views.py | Python | py | 8,596 | no_license | from django.urls import reverse
from .models import Sesi,Jadual
from urusetia.models import Zon
from persediaan.models import SubKomponen, Soalan
from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse_lazy
from django.contrib import messages
# from django.utils import timezone
... |
b421aa2058b9ffb548afd8dff46512b4bc841199 | cbe165ba7ff10b99ce14783cf1058469d2f51597 | XavierPlayzTheDueldox/Python_Lvl2 | /.vscode/Lists/ex116.py | Python | py | 693 | no_license | #Ex 116 Pig Latin Improved
from ex115 import pig_latin
#reading n splitting
inp = list(input('Enter a string:'))
#Tracks Data of punctuation
upper, punc = None, list()
if not inp[-1].isalpha():
punc.append(inp[-1])
inp.pop(-1)
if inp[0].isupper():
upper = True
inp[0] = inp[0].lower()
listofwords... |
877f45ccea5cef3de7cda3cb6ab5501feb94726b | 8bdce8ec6380280856075cc0b63c4abbd75b154d | natallem-ITMO/ml-course | /labs/Codeforces_labs/lab4/E.py | Python | py | 2,160 | no_license | from math import log
from math import exp
K = int(input())
fines = [int(elt) for elt in (input()).split()]
intense = int(input())
N = int(input())
word_in_class = {}
class_in_input = {}
all_words = set()
for i in range(N):
he = [elt for elt in (input()).split()]
cur_class = he[0]
words = {elt for elt in he... |
d4527babdaa2286ecaa2181c1823b921093ddb83 | 2f8fa4f9bfe101aff0dd3fe972786333e327d953 | ChiragBhalgami/tests | /tests/sqlqa/tests/general/vals/mytest0011.py | Python | py | 2,202 | permissive | # @@@ START COPYRIGHT @@@
#
# (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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... |
75b969ec35ceda992e1357afe0498aadc9a6c1b8 | dbb589733056bd2ff1e51f5cfa3823d08e23397c | jvivian/common-workflow-language | /reference/cwltool/validate.py | Python | py | 4,519 | permissive | import pprint
class ValidationException(Exception):
pass
def validate(expected_schema, datum):
try:
return validate_ex(expected_schema, datum)
except ValidationException:
return False
INT_MIN_VALUE = -(1 << 31)
INT_MAX_VALUE = (1 << 31) - 1
LONG_MIN_VALUE = -(1 << 63)
LONG_MAX_VALUE = (1 ... |
f58cdb5a4e958fb38d7f19da14fd77c6c19065a4 | 4d494f3969c5b97807fa1a46fc024e45624b8e8c | Th3R3p0/openAWS | /openAWS.py | Python | py | 5,905 | no_license | import boto3
import argparse
import json
# defaults to only look at running instances. Add "stopped" to list if you want
# to check for stopped instances as well
CHECK_INSTANCES = ["running"]
VERBOSITY = False
ALL_REGIONS = ["us-east-1", "us-east-2", "us-west-1", "us-west-2", "ap-south-1", "ap-northeast-1", "ap-nor... |
827a8126402b0a0fdac8c747d4f12afa8d98ab96 | d710628232f27595d50e24420809e9050c094bbd | xuepl/gy_automations_api_backend | /gy_automations_api/settings.py | Python | py | 4,941 | no_license | """
Django settings for gy_automations_api project.
Generated by 'django-admin startproject' using Django 2.0.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
i... |
a50ce9f64fd44638a1ab516e83a2c95666568f56 | a065e6f7848df1f2a1b7f097aea48197d7e520db | bianjunjie/Project-Euler-Problems | /pro59.py | Python | py | 655 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Junjie Bian
# File Name: pro59.py
# Description:
def solve(s,i,j,k):
ans=[0]*len(s)
for (idx,w) in enumerate(s):
if idx%3==0:
ans[idx]=w ^ i
elif idx%3==1:
ans[idx]=w ^ j
else:
ans[idx]=w ^ k
if ans[idx]<ord(' ') or ans[idx]>ord('z'):... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.