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 |
|---|---|---|---|---|---|---|---|---|
be8164990fd85ee399e9b752525efe59225a441e | cb3ab673325244e4be1d80bb3a827cc3e1655f38 | itshelenxu/unrealcv | /client/examples/generate-images.py | Python | py | 9,990 | permissive |
# coding: utf-8
# # Generate Images from demo RealisticRendering
# This ipython notebook can be found in [client/examples/generate-images.ipynb](https://github.com/qiuwch/unrealcv/blob/master/client/examples/generate-images.ipynb). Before you start, please read the [Tutorial: Getting Started](http://unrealcv.github.... |
3fb136ed5859e37f806a0cfa98851c82057373e4 | 0fa2adca68d511cc8a97e20b49076a68f7eaed0b | eric-xw/habitat-api | /habitat_baselines/rl/ppo/policy.py | Python | py | 9,979 | permissive | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
from habitat_baselines.rl.ppo.utils import Flatten, CategoricalNet
import numpy as ... |
dc825078ccb834f86b568dc75c20e03a2fd1edfb | 2564074489cfc88ca5ac4f2a9aebcc9c766c2550 | Ibragim97/choco | /main/migrations/0004_auto_20170917_0034.py | Python | py | 1,384 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-17 00:34
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('main', '0003_auto_20170916_1240'),
]
operations = ... |
e9ca41d9547050fe97cd5657eb908201b9ad306e | 30829faacf74eb7c781ed61104449d591d7e11ac | misterlei/mydemo1 | /myobject/myadmin/types.py | Python | py | 2,383 | no_license | from django.shortcuts import render
from django.http import HttpResponse
from myadmin.models import Type
import time
def index(request):
# 执行数据查询,并放置到模板中
list = Type.objects.extra(select = {'_has':'concat(path,id)'}).order_by('_has')
# 遍历查询结果,为每个结果对象追加一个pname属性,目的用于缩进标题
for ob in list:
ob.pname ... |
cd592f8e2f98dcd8b22b30cbda8d1ca5d88965bb | d8c5cbc53e0a4e0a9d7e79065a830ac0d2b6dc25 | thetomcraig/HERON | /heron/bots/models/base.py | Python | py | 2,860 | permissive | from django.db import models
import logging
class Bot(models.Model):
class Meta:
abstract = True
real_name = models.CharField(max_length=1000, default="PLACEHOLDER")
first_name = models.CharField(max_length=1000, default="PLACEHOLDER")
last_name = models.CharField(max_length=1000, default="PL... |
499b8849167319fd74ee3cd71bbe61278d08c4d1 | 510457f11cf066f57bc0e01579e42cad04c9e6e5 | mkd63/book-recommend-backend | /interests/migrations/0001_initial.py | Python | py | 750 | no_license | # Generated by Django 3.0.6 on 2020-05-06 08:56
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
1d8cc2e776db4df762888492e4b614671a2c9344 | 50713f986d5a1e57477a449d8d3e98cfbe3c3f24 | shanibenb/Domain-Transfer-using-DIP | /Summer-Winter/data/unaligned_dataset.py | Python | py | 2,117 | no_license | import os.path
from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
from PIL import Image
import random
class UnalignedDataset(BaseDataset):
def initialize(self, opt):
self.opt = opt
self.root = opt.dataroot
self.dir_A = os.path.join(opt.datar... |
420d69aa251257b657a438419b2463c453c68716 | 943924eee072837694184c21607ca7c66785116b | HewlettPackard/oneview-python | /examples/drive_enclosures.py | Python | py | 3,067 | permissive | # -*- coding: utf-8 -*-
###
# (C) Copyright [2019] Hewlett Packard Enterprise Development LP
#
# 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
#... |
554d6e52871d0aa77c9538fa2fb8a90750f565f9 | a1e15b6d9196b7b59f5a69aaba4565ccebcea92a | xantares/pyglet | /tests/base/future_test.py | Python | py | 901 | permissive | from builtins import bytes
import sys
import unittest
if sys.version_info[:2] < (3, 0):
_py2 = True
else:
_py2 = False
class FutureTestCase(unittest.TestCase):
"""Base class for unittests that adds compatibility for both the Py2 and Py3 version of the
unittest module."""
if _py2:
assertC... |
a05afbd50436efc14a682e09e0cd0febb94058d1 | c459839c767a344e4cfab106d48ebba11db78635 | shekhargulati/june-2014-blog-pythonjs | /node_modules/python-js/code_writer.py | Python | py | 766 | no_license | import sys
if sys.version_info.major == 3:
import io
StringIO = io.StringIO
else:
from StringIO import StringIO
class Writer(object):
def __init__(self):
self.level = 0
self.buffer = list()
self.output = StringIO()
self.functions = []
def is_at_global_level(self):
return self.level == 0
def push(s... |
34c75a62dc4859eec3fb5e3376a2ee34debac3e8 | 667ca0bda407f67a8f51bb49c5451fc67f5a0853 | mahima-manik/networks-and-systems-security | /A3/kdc.py | Python | py | 1,947 | no_license | #KDC
import Crypto.Hash.MD5 as MD5
import Crypto.PublicKey.RSA as RSA
import Crypto.PublicKey.DSA as DSA
import Crypto.PublicKey.ElGamal as ElGamal
import Crypto.Util.number as CUN
from Crypto.Cipher import DES
import ast
import socket, sys, os
import datetime, time
kdc_server_ip = ""
kdc_server_port = 65159
key = R... |
d078414f154a017a358686edeb7265bced81c8b9 | f1238a5e80dc71a5f05959541f409a47b0f676ea | Redbu11dev/pythonProjectMantisTest | /venv/Lib/site-packages/ftputil/host.py | Python | py | 41,235 | no_license | # Copyright (C) 2002-2020, Stefan Schwarzer <sschwarzer@sschwarzer.net>
# and ftputil contributors (see `doc/contributors.txt`)
# See the file LICENSE for licensing terms.
"""
`FTPHost` is the central class of the `ftputil` library.
See `__init__.py` for an example.
"""
import datetime
import errno
import ftplib
imp... |
5382f518c900669059eb6e70d67f353520250bc6 | 780b52c7c1cbc06ef69c4f7afe32a44eb9d54945 | tungluu18/echocardio-app | /config.py | Python | py | 814 | no_license | import os
import logging
from dotenv import load_dotenv
__author__ = 'Tung.Luu'
_logger = logging.getLogger(__name__)
load_dotenv()
# URL
HOST_URL = 'http://localhost:5000'
# DIRECTORY
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
DATA_DIR = 'data'
UPLOAD_DIR = 'data/tmp'
# DATABASE
_DB_NAME = os.getenv('D... |
8137c98370def7f3501a56eaa4ff7bc4b592f32b | 81f12d9c3db77b80c0f5025ec7cf61fe007c7159 | mila-iqia/training | /milabench/setup.py | Python | py | 556 | no_license | #!/usr/bin/env python
from setuptools import setup
if __name__ == '__main__':
setup(
name='milabench',
version='0.0.1',
description='Implement a few utilities to help benchmark code',
author=[
'Pierre Delaunay',
'Olivier Breuleux',
],
packag... |
5efc121b1771beb4a463b2e5f9b0ab6115034b82 | 96898769320c87fd043f540386b164e7aca21a62 | anhstudios/swganh | /data/scripts/templates/object/mobile/shared_dressed_wallaw_loowobbli.py | Python | py | 450 | 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 = Creature()
result.template = "object/mobile/shared_dressed_wallaw_loowobbli.iff"
result.attribute_template_id = 9... |
8b1824da07318a34d089912f699d6db9c1bb9621 | 9cfc4896b26ad0205795dd9384446c75d168daff | SUZhaoyu/dv-det | /eval/waymo/waymo_eval_OpenPCDet.py | Python | py | 10,494 | no_license | # OpenPCDet PyTorch Dataloader and Evaluation Tools for Waymo Open Dataset
# Reference https://github.com/open-mmlab/OpenPCDet
# Written by Shaoshuai Shi, Chaoxu Guo
# All Rights Reserved 2019-2020.
import numpy as np
import pickle
import tensorflow as tf
from google.protobuf import text_format
from waymo_open_datase... |
1a261c16c031f6365f126106b8c48963d45732dc | c071f328dbc4162d6035516f9dd6ed1508cf9e65 | herr-biber/dd-pose | /dd_pose/evaluation_helpers.py | Python | py | 18,762 | permissive | import numpy as np
import zipfile
import StringIO
import os
import json
import pandas as pd
import transformations as tr
from multiprocess import Pool
import plotly
import plotly.graph_objs as go
from dd_pose.dataset_item import DatasetItem, StampedTransforms
# a coordinate frame which allows for identity transforma... |
f9b653d98c5c8fb72ebf1e1f981aa6833d7cfa23 | 6d7325559bc328cf4e3e1de001974dba30bfaea6 | lkwilson/math435 | /p2/final_model.py | Python | py | 698 | no_license | import numpy as np
import matplotlib.pyplot as plt
beta = 717
mu = 260
gamma = 1290
rho = 0.3
alpha = 1.28 * 10**-4
def h(t):
return 64 / (1 + 212.33 * np.exp(-2.28*t))
def w(t):
return 6980 / (1 + 697 * np.exp(-1.256*t))
def f(k):
return gamma * w(k)
def c(k):
return (beta + gamma) / (1 - rho... |
5e672627cca75c045c132ba65b1cd468a9a75dfa | 7f198f31e3020c42fad103e79623f9400e1eba61 | ruudel/Soe-Raev | /Robot/Susi.backup.py | Python | py | 5,856 | no_license | # -*- coding: utf-8 -*-
import cv2
import numpy as np
import cv2.cv as cv
import serial
import time
from time import sleep
parem = serial.Serial('/dev/ttyACM2', timeout=1, parity=serial.PARITY_NONE, baudrate=115200)
vasak = serial.Serial('/dev/ttyACM1', timeout=1, parity=serial.PARITY_NONE, baudrate=115200)
coil = se... |
849b5797a36216d00b40b4334e60f1c638033439 | 55763ec08a6b8615cc6b1456279a1b08e9b9ed7b | napobear/fritzconnection | /fritzconnection/core/fritzmonitor.py | Python | py | 9,404 | permissive | """
Module to communicate with the AVM Fritz!Box service providing real time
phone-call events.
To run fritzmonitor, the CallMonitor service of the box has to be activated.
This can be done with any registered Phone by typing the following codes:
activate: #96*5*
deactivate: #96*4*
"""
# This module is part of the Fr... |
3134117922ca3b117c6aa7922834c32d5ddf9e3d | 6b6447dd1109f20eb3ee58471d9bb3a12e816a41 | ishand/interactivepython | /pong.py | Python | py | 5,215 | no_license | # Implementation of classic arcade game Pong
import simplegui
import random
# initialize globals - pos and vel encode vertical info for paddles
WIDTH = 600
HEIGHT = 400
BALL_RADIUS = 20
PAD_WIDTH = 8
PAD_HEIGHT = 80
HALF_PAD_WIDTH = PAD_WIDTH / 2
HALF_PAD_HEIGHT = PAD_HEIGHT / 2
paddle1_pos = [HALF_PAD_WIDTH, ... |
74dd3e2177b0dac7fe9bc31184ace09a2757b842 | 1aa0da7b89439970add1a21d0ebf3370a699d5eb | Ngugisenior/devto | /python/pythonQuery.py | Python | py | 1,494 | no_license | #Import your dependencies
import platform
from hdbcli import dbapi
#verify the architecture of Python
print ("Platform architecture: " + platform.architecture()[0])
#Initialize your connection
conn = dbapi.connect(
#Option 1, retrieve the connection parameters from the hdbuserstore
key='pyraxuserkey', # addre... |
f4934c319f758b2b3e43cd766f59cea14cd84cdb | 9aafeba94f655191419776e34ea3808113a27ead | xbassi/game_of_deep_learning | /pytorch-image-models/models/test_time_pool.py | Python | py | 1,657 | no_license | from torch import nn
import torch.nn.functional as F
from models.adaptive_avgmax_pool import adaptive_avgmax_pool2d
class TestTimePoolHead(nn.Module):
def __init__(self, base, original_pool=7):
super(TestTimePoolHead, self).__init__()
self.base = base
self.original_pool = original_pool
... |
f5a733460235ecbae7d155793e81bebfa792ca57 | 4144f50357ffbfbf107b4f684c42b3341e2fb7bd | Calvonator/conwaysgame | /conNumbPyway.py | Python | py | 534 | no_license | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
fig = plt.figure()
def f(x, y):
return np.sin(x) + np.cos(y)
x = np.linspace(0, 2 * np.pi, 120)
y = np.linspace(0, 2 * np.pi, 100).reshape(-1, 1)
plt.axes(xlim = (0, 100), ylim = (-50, 50))
im = plt.imshow(f(x, y), anima... |
a68cdace1eb531f0fdfe50eb996de88426922272 | f56447d41f802bdf53afa93b91bb5eebea3cc549 | anders94/mitcoin | /share/qt/extract_strings_qt.py | Python | py | 1,873 | permissive | #!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
import glob
import operator
import os
import sys
OUT_CPP="qt/mitcoinstrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' for... |
a2f6170953032ba4d141f75e37735293a3d893e0 | b157a42bd87f3df1fad858b180e14a18b2877091 | TrellixVulnTeam/fall-2021-hw2-451-unavailable-for-legal-reasons_6YX3 | /mayan/apps/messaging/tests/test_views.py | Python | py | 5,031 | permissive | from mayan.apps.testing.tests.base import GenericViewTestCase
from .mixins import MessageTestMixin, MessageViewTestMixin
from ..events import event_message_created, event_message_edited
from ..models import Message
from ..permissions import (
permission_message_create, permission_message_delete,
permi... |
f79de06b857a69a09b9be96973d3015486826329 | 356b7577d49054d2a7f585939e6ceec14aa9cc06 | hputiprawan2/flask-aprt | /db_create.py | Python | py | 247 | no_license | from app import db
from models import BlogPost
# create the db and the db tables
db.create_all()
# insert
db.session.add(BlogPost("Good", "Very clean"))
db.session.add(BlogPost("Nice", "Staff is nice"))
# commit the changes
db.session.commit() |
bbd47b583edb61dce2181381b6398439c67f8ce0 | a1a45ab62dfa4acf670adde4bc67df46334b0fb5 | C-Erastus/SecureDrop | /app/test.py | Python | py | 490 | permissive | import time
import threading
class TestThreading(object):
def __init__(self, interval=1):
self.interval = interval
thread = threading.Thread(target=self.run, args=())
thread.daemon = True
thread.start()
def run(self):
while True:
# More statements comes h... |
8ee37497a745bc0ab88832315d43eccf47d14637 | aec1645e65eea18c667ad744fc69b1fa4bf5a84e | mgracioli/conexaoSQLitePython | /usuario.py | Python | py | 1,040 | no_license | #cria um modelo de usuário
class Usuario(object):
#método construtor
def __init__(self, nome, telefone, email, cpf):
self.__nome = nome #o __ informa que essa variável é do tipo private. Em python não existe variável privada, então, isso é só uma convenção para dizer que essa variável deve ser... |
ab6d1bb43cc02c30a562bc1d743f1596e7fb9282 | e2bfa078feefdff30802d29337054ef84c418d3d | ibrahimGuilherme/Exercicio_Guilherme | /exercicio45.py | Python | py | 419 | no_license | import random
sorteio = random.randint(0, 10)
valor = int(input('Qual o valor sorteado (entre 0 e 10)? '))
tentativas = 0
while valor != sorteio:
if valor != sorteio:
print('Incorreto.')
valor = int(input('Qual o valor sorteado (entre 0 e 10)? '))
tentativas += 1
else:
tentativas += 1
... |
842ed9d8130e31b8f147afc1992963479c286d87 | ecf9297ab596362a0b66ff7b276c6f2a36858031 | lastproxy/isofit | /isofit/core/isofit.py | Python | py | 5,473 | permissive | #! /usr/bin/env python
#
# Copyright 2018 California Institute of Technology
#
# 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
#
# Unles... |
96325824c71404dd375967c717533649c0408a84 | 043910b14441f55f7e9b1dd4a2b802447c1f39a5 | syurskyi/Algorithms_and_Data_Structure | /_algorithms_challenges/leetcode/lc-all-solutions/282.expression-add-operators/expression-add-operators.py | Python | py | 843 | no_license | class Solution(object):
def addOperators(self, num, target):
res, self.target = [], target
for i in range(1, len(num) + 1):
if i == 1 or (i > 1 and num[0] != "0"): # prevent "00*" as a number
self.dfs(num[i:], num[:i], int(num[:i]), int(num[:i]), res) # this step put first number in the string... |
4dda0b96718c936158076b200cc48f603215a12e | 47c83cbd710a8cf3cb86f2cbbd3bc12eacdf45ac | ingcesarcm/YoA_CRM | /YoA_CRM/urls.py | Python | py | 581 | no_license | """
Definition of urls for YoA_CRM.
"""
from django.conf.urls import include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = [
# Examples:
# url(r'^$', YoA_CRM.views.home, name='home'),
# url(r'^YoA_CRM/', include('YoA_CRM.Y... |
47d06d7214a9f161bb2985165a0334f4fea0d13c | 14d339ac207d76e9112402f904ba0210a0fab559 | AmanChorobaev/TODOLIST | /main/views.py | Python | py | 2,117 | no_license | from django.shortcuts import render, HttpResponse, redirect
from .models import ToDo, Books
def homepage(request):
return render(request, "index.html")
def test(request):
todo_list = ToDo.objects.all()
return render(request, "test.html", {"todo_list": todo_list})
def second(request):
return HttpRe... |
fd32204e454a98717911efc79abfc0a7b44fb742 | f094c9a2e4570e9fb2a424e2ce750efbea6d6bbb | SergeZazik/iSi-Test | /iSi_apps/dialogs/migrations/0001_initial.py | Python | py | 1,703 | no_license | # Generated by Django 2.1.2 on 2018-11-06 09:24
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
1d38b6bb38262a0f2f3d5ff05f0e257026821cdf | fc14c076737a95911afd757af297a3a52ec8598b | violet712/RLs | /rls/algorithms/single/hierarchical/aoc.py | Python | py | 11,222 | permissive | #!/usr/bin/env python3
# encoding: utf-8
import numpy as np
import torch as th
import torch.distributions as td
import torch.nn.functional as F
from rls.algorithms.base.sarl_on_policy import SarlOnPolicy
from rls.common.data import Data
from rls.common.decorator import iton
from rls.nn.models import AocSha... |
a319a7a8b35d72178e1987ea9919dae86e3dfcd2 | f567e9081e1f58f07c8ed0359d70ed2554ad5cb7 | 3dformortals/data | /imagebatch/png/pngbatchHueLoop/hueloop.py | Python | py | 3,866 | no_license | import os,sys,datetime,colorsys
from PIL import Image
from PIL.Image import ADAPTIVE
if getattr(sys, 'frozen', False):
mydir = os.path.dirname(sys.executable)
elif __file__:
mydir = os.path.dirname(os.path.abspath(__file__))
print("------------mydir------------")
print(mydir)
print("------------------------")... |
44577c93280138fa0a92a6c371b00c2c41569f93 | 11d185f205021f12b46b8945df2a5e89d9b911ce | KhaledSharif/DeepMVS | /python/train.py | Python | py | 14,096 | permissive | import os
import sys
import argparse
import threading
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torchvision as vision
from model import DeepMVS_PT, DeepMVS, weights_init
from generate_volume_train import generate_volume_train
# Pa... |
2f32eecec4fb6d7d858cfa3b639faf3f14550f60 | 781b4184ad1428db055d9495d49332cd46d37837 | yukari007/TZwareInstaReportBot | /main[PY].py | Python | py | 4,555 | no_license | #just the imports
from time import time, sleep
from random import choice
from colorama import Fore, Back, Style
from multiprocessing import Process
from libs.utils import CheckPublicIP, IsProxyWorking
from libs.utils import PrintStatus, PrintSuccess, PrintError
from libs.utils import PrintBanner, GetInput, P... |
48cd0cf4ebd22a4606b1459d37194d2609693cdb | 68eae149198e174a866bb5b2748e2f6e9166b021 | alessandraseiter/csci7-alessandra | /05_problem2_test.py | Python | py | 3,281 | permissive | """Module to count how many of each digram there are in a fasta file then define a dictionary from that count"""
def digram(n):
# create empty lists for each character that will be counted
aa = []
ag = []
ac = []
at = []
ga = []
gg = []
gc = []
gt = []
ca = []
cg = []
c... |
c1a46847e933e92ad96a1971c6270436f375cd02 | e3d39e95eef9b741aea7ade4b1bed4ff751cf14e | Sihebo/Rosalind_projects | /Finding_a_motif_in_DNA.py | Python | py | 970 | no_license | s = "ATGACCTCAAACCCCTCTGGTGGCGAAAACCCCGTACTAAAACCCCGAAACCCCTCAGAAACCCCAAACCCCAAACCCCGGTTGAAACCCCAAACCCCTCAAAACCCCAAACCCCAAACCCCAAACCCCAAACCCCACGTCTCTAAACCCCTAAACCCCAAACCCCGAAACCCCTGGACGGAAACCCCCAAACCCCTAAACCCCGAAACCCCAAACCCCACCTGTAAACCCCACAAACCCCGCGAAACCCCAAACCCCTAAACCCCTATAAACCCCAAACCCCCGAAACCCCTCCAACAAACCCCACGGAAACCC... |
d6f9839456365e0a5e9a66d7418d3c4b75a252c7 | ee29098251a8b7013c827ea8cbd56047bcb787d4 | Konstantin26rest/Scraping-eex-transparency | /scrCapacity.py | Python | py | 4,754 | no_license | #Import libraries
import scrDefine
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import time
import pymongo
from datetime import datetime
# Initialize ChromeDriver
# Load web page for selected country
def _funcLoadWebPage(country_id):
driver = webdriver.Chrome()
... |
3f799948ab2de32bbe12b73d9fa9057c864bd955 | cad8021d88c236f80a65b5a999f13eaadde467f8 | kevin510610/Book_AGuideToPython_Kaiching-Chang | /unit08/exercise0804.py | Python | py | 209 | no_license | def sum(p):
i = 1
s = 0
while i <= p:
s += i
i += 1
return s
end = int(input("n: "))
print(sum(end))
# 檔名: exercise0804.py
# 作者: Kaiching Chang
# 時間: July, 2014
|
28566cdeca655cccdc2f4fc8106026a370ff5341 | cee46e60842019cb0684df7f230cc9255212f0d6 | naomi-rc/PythonTipsTutorials | /introspection.py | Python | py | 398 | no_license | # dir : functions and attributes belonging to an object
print(f"{dir(list)}\n")
# type : returns type of object
print(f"{type('hi')}\n")
# id : returns unique identification of an object
print(f"{id('hi')}\n") # will be different each time
# inspect module : provides other functions for introspection (more info tha... |
46c4b960c07c0547ed8c4bfd133f299de8e7c565 | f11d450145e601898db1a93debb08c64d13d0ead | thanh-cnguyen/aI-assistance | /AI.py | Python | py | 3,174 | no_license | import wikipedia
import os
import pyttsx3
import speech_recognition
from datetime import date
bot_mouth = pyttsx3.init()
voices = bot_mouth.getProperty('voices')
bot_mouth.setProperty('voice', voices[1].id)
bot_ear = speech_recognition.Recognizer()
bot_brain = "How may I help you, Boss?"
today = date.today(... |
07284a8d60b79936f6359730fb7682dbbe3d5e7a | fdd823f3c96ec24ff90e3372a07c217b6cfdd2c2 | xjhuang1993/PythonExercise | /leetcode/049.Group Anagrams/common.py | Python | py | 482 | no_license | """
Accepted
"""
def func(ss):
tmp_dict = {}
for s in ss:
tmp_list = list(s)
tmp_list.sort() # 先排序保持唯一性
tmp_tuple = tuple(tmp_list) # 元组可哈希
if tmp_tuple not in tmp_dict:
tmp_dict[tmp_tuple] = [s]
else:
tmp_dict[tmp_tuple].append(s)
return [... |
654e99237a0ad4662a496f6f9c110329ffd19956 | e01ac223b39f0b261412eebdb5646f1c16c059f7 | jingqiangliu/cstar_perf | /frontend/cstar_perf/frontend/server/model.py | Python | py | 31,553 | permissive | ## Queries this app has to answer:
###
### Tests:
### * Schedule a test to run
### - schedule_test(test_id, user, cluster, test_definition)
### * Retrieve a test by id
### - get_test(test_id)
### * Retrieve tests that have not yet run, status=new
### - get_scheduled_tests
### * Retrieve tests that a user h... |
2e571d77c9ba722c8526f511d9de8d95c46e7f3e | 4e8a04c056e5879a9409f1933445cd6801cfd09b | minrk/telemetry | /tests/test_register_schema.py | Python | py | 4,043 | permissive | import io
import json
import logging
import tempfile
import jsonschema
import pytest
from ruamel.yaml import YAML
from jupyter_telemetry.eventlog import EventLog
def test_register_invalid_schema():
"""
Invalid JSON Schemas should fail registration
"""
el = EventLog()
with pytest.raises(jsonschem... |
7d010522ee9db84438144b5b23a0717c77bbbd65 | 75638a1a9cf6dc40c5db12f11a6f4f0746dc6f5a | 22shubham22/htmlparser | /http_parser/master_parser.py | Python | py | 834 | no_license | from urllib.request import Request, urlopen
from http_parser.response_parser import ResponseParser
from http_parser.page_parser import PageParser
from tools.general import *
class MasterParser:
@staticmethod
def parse(url, output_dir, output_file):
print('Crawling ' + url)
resp = urlopen(Requ... |
c0f3f4acd640bdc7cc250d660a1a62f8c79394c8 | 177b82324a76603607f434b61dcfd6909c093fdf | Python3pkg/ItChat | /itchat/utils.py | Python | py | 5,135 | permissive | import re, os, sys, subprocess, copy, traceback, logging
try:
from html.parser import HTMLParser
except ImportError:
from html.parser import HTMLParser
import requests
from . import config
logger = logging.getLogger('itchat')
emojiRegex = re.compile(r'<span class="emoji emoji(.{1,10})"></span>')
htmlParser... |
0d92cfa99a67a5a2ee6d5cd33cd902d774cc7cda | a848372ab60ccbd5cd6b53180470bc48633675cf | lyb0926/PyQt5-expro | /main.py | Python | py | 467 | no_license | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main.py'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
import sys
import contr
from PyQt5.QtWidgets import QApplication, QMainWindow
if __name__ == '__main__':
app = QApplicat... |
7ec432d17874f45299880780c6959a52f4062deb | f4a6bb002fa390cf771581116f345ffb5bb3044d | contactshadab/data-structure-algo-python | /data_structure/binary_tree/height_of_binary_tree.py | Python | py | 753 | no_license | from binary_search_tree_implementation import BinaryTree
class MyBinaryTree(BinaryTree):
# Height of Binary Tree is the maximum no of edges from its leaf to its root
# Algo: height of a sub tree is 1 + height of its subtree till we encounter None
def height(self):
return self.__height(self.root)
... |
e8bf184bae72f3e9e071dfb6e308af5ef693c26d | edc3dd54327e428f3bebb388fdbd293bd242a25e | ArkhipovNikita/budget_tracking_bot | /branches/base.py | Python | py | 917 | no_license | from itertools import zip_longest
from aiogram.dispatcher.filters.state import default_state
from blocks import BaseBlock
class BranchMeta(type):
def __new__(mcs, name, bases, attrs, **kwargs):
cls = super().__new__(mcs, name, bases, attrs)
cls._blocks = []
for name, prop in attrs.items(... |
fc91258a7de532a5f736a2e8dae98ec3b0c4ed46 | 718df4e56471265b8770066060aed7945f97ba6e | dylanawhite92/Python-Automation | /Python Basics/Functions/guessTheNumber.py | Python | py | 767 | no_license | # This is a guess the number game
# import random module
import random
# Store random integer between 1 and 20
secretNumber = random.randint(1, 20)
print('I am thinking of a number between 1 and 20.')
# Ask the player to guess 6 times
for guessesTaken in range(1, 7):
# Prompt user input
print('Take a guess.'... |
b2549e09b2a15fe1291dae284ff2dca4d532e332 | c2b19fb15f04aabed940f5659ba4557522692096 | gilliam/gilliam-aws | /gilliam_aws/commands.py | Python | py | 9,374 | permissive | # Copyright 2013 Johan Rydberg.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
9510fa286c0ec82063951aaa361005c2d7cef457 | 1e95fac9285ee1f9b934a6baa222e3beb39a74bb | apache/spark | /python/pyspark/pandas/tests/connect/test_parity_default_index.py | Python | py | 1,720 | permissive | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
4d9d754691b8b445376dd97c2896fdae618c9db4 | 2645e23e480a980b845b74153bba6c0900549bb0 | cgandu/AlgoritmoEstrella | /AlgoritmoEstrella.py | Python | py | 9,593 | no_license | import heapq
#defino funcion que devuelva distancia en linea recta a destino
def F_Distancia_Recta(a, b):
#calculo distancia como un pitagoras (distancia directa en diagonal)
return np.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
def F_Estrella(mapa, ini, fin):
#defino posiciones adyacentes para cada... |
e2de4c463039df1431351d23bfe29810a5846440 | 9ddc9d5d89ea5a0fd47ea92f43c2766561a0f2b0 | gmuj/django-mangopay2 | /mangopay2/tests/factories.py | Python | py | 6,890 | permissive | import datetime
from django.contrib.auth.models import User
from django.contrib.auth.hashers import make_password
from django.conf import settings
from mangopay.constants import LEGAL_USER_TYPE_CHOICES, BANK_ACCOUNT_TYPE_CHOICES, DOCUMENTS_TYPE_CHOICES, \
PAYIN_PAYMENT_TYPE
from money import Money
import factory
... |
bc11e266726b9b863274a9fc1e303214fb63d03c | a995216c9acba5f54248f663977106eacc7fe255 | goforks12/PettingZoo | /pettingzoo/mpe/simple_push_v2.py | Python | py | 511 | permissive | from pettingzoo.utils.conversions import parallel_wrapper_fn
from ._mpe_utils.simple_env import SimpleEnv, make_env
from .scenarios.simple_push import Scenario
class raw_env(SimpleEnv):
def __init__(self, max_cycles=25, continuous_actions=False):
scenario = Scenario()
world = scenario.make_world(... |
4d0225a74fe95079c502adf7e8257ae1a83166f9 | 977dded4fa5e6c742e075e5edfc1979102e01b05 | williamsnieves/websiteproject | /willisiteback/apps/categories/serializers.py | Python | py | 214 | no_license | from rest_framework import serializers
from .models import Category
class CategorySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Category
fields = ('name', 'type',)
|
b50851c9ecb78cce3360f8adc03246c4bdf74888 | e89e496102ffb6671eb7d5e0419b181ef0bc567d | AhmedAhmedFekry/django-social-media | /media/views.py | Python | py | 17,088 | no_license | from django.shortcuts import render, get_object_or_404
from .models import *
from .forms import *
from publish.forms import *
from publish.models import *
from django.urls import reverse
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, JsonResponse
from django.con... |
2605fbd2f7ccdd7fba73ef2cb8cc8c857f3d1a3f | 4ff39cb46c34f43a80b9a76fd884bb62b8e9998a | hpreston/netdevops_demos | /netdevops-security/env_vars/env_var_demo1.py | Python | py | 2,372 | permissive | #! /usr/bin/env python
"""Script to retrieve interface list using NETCONF
This script will retrieve information from a device.
Copyright (c) 2018 Cisco and/or its affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Softwar... |
119da507c44bb17f913d7755f742b48704ee8c22 | 34d61b7582a8d6596264a75eb6c42cbad7f2a4bc | shstan/tree_algorithms | /segment_tree.py | Python | py | 2,998 | no_license | import numpy as np
import math
"""
Rudimentary implementation of rangequery!
"""
class segment_tree:
def __init__(self, arr):
self.arr = arr
layers = math.ceil(math.log2(len(arr)))
self.tree = np.full(shape=((2**layers) * 2 - 1, ), fill_value=np.PINF)
self.constructTree(arr, low=0, h... |
e1b587cc48abb10b6fe88b2300cbfbf2a4fccbeb | 13f2e44bd00a8aa95c66ba075bd44a2e475e01e4 | pruthvicharan47/charan | /sample_app/sample_app.py | Python | py | 225 | no_license | from sample_app.package_one.pack_one import PackOne
from sample_app.package_two.pack_two import PackTwo
def main():
p1 = PackOne()
p2 = PackTwo()
p1.do()
p2.process()
if __name__ == '__main__':
main()
|
c3277bdd370893e876e718b2508a686e043aa4ca | aa55403aabc2dc3959a02a589a5b86c3b2a1066e | icaromsc/tReMagic | /find_repeats.py | Python | py | 7,920 | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from collections import Counter
import numpy as np
import matplotlib.pyplot as plt
import plotly.plotly as py
import sys
def open_file(position=0,file="... |
61d96d42556c697569e4aa34a651e9358ba4b825 | 6042f760f11c1383e3b104eb6c1671d30a894ba3 | asvetliy/sources-fms | /sources/core/shared/use_case.py | Python | py | 274 | no_license | class UseCase(object):
def __init__(self, repo):
self.repo = repo
@classmethod
def make(cls, repo):
return cls(repo)
def process(self, request_object):
raise NotImplementedError('process_request() not implemented by UseCase class')
|
b395fbed9d898ec14c149beabe946812828bbe8e | 5ab36756cbb5ae3d3a89716368d7b88d792f466d | fertorakosi-loveszklub/ctrl-raspberry | /LCD.py | Python | py | 673 | no_license | from Lib import I2C_LCD_driver
import time
class LCD:
def __init__(self):
self.screen = I2C_LCD_driver.lcd()
def write_default(self):
self.write_new('Fertorakosi', 'Loveszklub')
def message_and_reset(self, message, message2=None, timeout=1.5):
self.write_new(message, message2)
... |
6db3288c02158dae175a6648d2d6f7056c90785a | 9af6112f1cfc17a522547c2f36915822bb8a9eb9 | braun-steven/detectron2_backbone | /detectron2_backbone/backbone/fpn.py | Python | py | 1,814 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# --------------------------------------------------------
# Descripttion: https://github.com/sxhxliang/detectron2_backbone
# version: 0.0.1
# Author: Shihua Liang (sxhx.liang@gmail.com)
# FilePath: /detectron2_backbone/backbone/fpn.py
# Create: 2020-04-30 11:44:33
# LastAu... |
d940c313ec6f6117311f71c83e3b19a06529f53d | 41c4db628f42504b851729d35be05312537f3632 | specimentracking/galaxy | /scripts/scramble/scripts/pysam-solaris.py | Python | py | 839 | permissive | import os, sys
# change back to the build dir
if os.path.dirname( sys.argv[0] ) != "":
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
sys.path.insert( 1, os.path.join( os.pardir, os.pardir, os.pardir, 'lib' ) )
from scramble_lib import *
tag = get_tag() # get the tag
clean() # clean up any existing... |
9c3c771963732fff7c8c343aa527cde2a87bd1da | c8c1bd513eb7e4c1f6a43e40f28f83e754860198 | M0use7/python | /python基础语法/day10-函数和文件操作/04-生成器.py | Python | py | 2,093 | no_license | """__author__ = 余婷"""
"""
"""
if __name__ == '__main__':
def func1():
for x in range(10):
return x
# 0 <class 'int'> < class 'function' >
print(func1(), type(func1()), type(func1))
# 1.yield关键字
"""
只要函数中有yield关键字,那么这个函数就会变成一个生成器。
a.有yield的函数,在调用函数的时候不再是获取返回值,
... |
602fbde9c792a7bed93633401ba6bd12427aa6aa | 24699e293794d8d4dc3bb223555f1611451f9dec | Arrotech/Data-Structures | /Breadth_First_Search/breadth_first_search.py | Python | py | 870 | no_license | from queue import Queue
class Vertex:
def __init__(self, name=None, neighbours=[], isVisited=False, distance=9999):
self.name = name
self.neighbours = neighbours
self.isVisited = isVisited
self.distance = distance
def add_neighbour(self, vertex):
if vertex not in self.n... |
a2b48cf62dcaf705fb761daf7667ebaeaa0df6b7 | 485bc13d27975ea7265a2ae603545e36eff9a7a6 | cu-swe4s-fall-2019/best-practices-Sayter99 | /style.py | Python | py | 1,109 | no_license | import sys
import os
def one(): print('one')
def two(): print('two')
def three(): print('three')
def four(): print('four')
def five(a, b, c, d, e): print(a, b, c, d, e)
def throw(): raise Exception('threw')
def oops(): print('oops')
def FindSum(var_one, var_two, var_three, var_four):
s = (var_one +
... |
f0d660156e56903af96f731d7e982485fe388521 | 5b12acc74260aa363aed89a6b316f59223c3d78d | josejo911/P1_IA_Busquedas | /puzzle.py | Python | py | 2,993 | permissive | '''
Proyecto # 1 Inteligencia Artificial
Busqueda utilizando algoritmos como A *
'''
import pprint
pp = pprint.PrettyPrinter(indent=4)
'''
Se tomo como referencia el video https://www.youtube.com/watch?v=GuCzYxHa7iA
y el codigo de github https://github.com/JaneHJY/8_puzzle
'''
def ei_star(__ASTART,__END):
... |
a12e78971b5df113369561b47e6ce364fef7b8bc | 73de2c5914d91443777aa2dde7c9b643db211dda | sweetrain096/instagram_django | /posts/urls.py | Python | py | 449 | no_license | from django.urls import path
from . import views
app_name = 'posts'
urlpatterns = [
path('', views.list, name="list"),
path('create/', views.create, name="create"),
path('<int:post_pk>/', views.detail, name="detail"),
path('edit/<int:post_pk>/', views.edit, name="edit"),
path('delete/<int:post_pk>... |
bd8110b9f5027a118661dd82bb6788de20afee4e | 234c4211143d8190295e85915cb91cae5980c866 | nd7141/Explore-Update | /python/run_data.py | Python | py | 13,507 | no_license | # author: sivanov
# date: 27 Oct 2015
from __future__ import division
import networkx as nx
import pandas as pd
import time
import random
import math
from collections import Counter
from itertools import chain, combinations
def read_graph(filename, directed=True, sep=' ', header = None):
"""
Create networkx gr... |
12e8cb59a851df735424cccd96980215f57ccb0f | c3de90642075adcff7d6f4f82888210b96892ee0 | mingmllu/tf-sandbox | /tensorboard/simple-example.py | Python | py | 814 | no_license | #
# This is a very simple example to show how to initiate a tf.summary.FileWriter
# that you can launch tensorboard
#
import tensorflow as tf
from datetime import datetime
now = datetime.utcnow().strftime("%Y%m%d%H%M%S")
root_log_dir = "tf_logs"
log_dir = "{}/run-{}/".format(root_log_dir, now)
a = tf.constant([1.0,... |
b152ec5a8a15daa04ce4ab126832d3ebfc52c6b3 | 913fcfb5823a9e70e4d97a328cd50da5157538ea | Koderua/AirBnB_clone_v3 | /api/v1/views/index.py | Python | py | 843 | permissive | #!/usr/bin/python3
"""
Returns json status response
"""
from api.v1.views import app_views
from flask import jsonify, request
@app_views.route('/status', methods=['GET']):
def status():
"""
json method that returns state of status
"""
if request.method = 'GET':
resp = {"status": "OK"}
... |
c4ae258dae9e68e41279c9e96734e78eafc5f2ec | 3c85a256758d9c4586bca4d025be546ff44a734a | MihaiColbasevici/Pentru-olimpiada | /Problema_4_Olimpiada.py | Python | py | 544 | no_license | n = int(input("Dati numarul de trepte: "))
pastila = 0
trepte = []
dif = 0
dif1 = []
for i in range(1, (n + 1)):
tr = int(input())
trepte.append(tr)
for i in range(0, (len(trepte) - 1)):
if (abs(trepte[i] - trepte[i + 1]) > 1):
pastila += 1
dif = abs(trepte[i] - trepte[i + 1])
... |
7ffc7d95f1921cf0517f4e5256ce38a807a4998d | 33a417e00b7142df575d38471fa53cdb018c436d | nickyfoto/lc | /python/tests/test_643.py | Python | py | 314 | no_license |
import inspect
from importlib import import_module
module_name = "643_maximum_average_subarray_i"
def test_643():
m = import_module(module_name)
s = m.Solution()
fn, _ = inspect.getmembers(m.Solution, inspect.isfunction)[0]
func = getattr(s, fn)
assert func(nums, k) == Output
|
1ca08668bb04592ee17d883296df27631da75790 | f36bc41efe65102b3846c322e82dbad4120fc2e5 | mdiener21/python-geospatial-analysis-cookbook | /ch10/TileStache-master/TileStache/Goodies/VecTiles/server.py | Python | py | 15,219 | permissive | ''' Provider that returns PostGIS vector tiles in GeoJSON or MVT format.
VecTiles is intended for rendering, and returns tiles with contents simplified,
precision reduced and often clipped. The MVT format in particular is designed
for use in Mapnik with the VecTiles Datasource, which can read binary MVT tiles.
For a ... |
2dc01a2d578e4773a237373a16ef0b4a9e89d063 | f6f0a8f32816120a10b4c910b91fc912f749861b | GRSEB9S/SMAC3 | /smac/facade/func_facade.py | Python | py | 3,123 | permissive | import logging
import numpy as np
from smac.facade.smac_facade import SMAC
from smac.scenario.scenario import Scenario
from smac.configspace import ConfigurationSpace
from smac.smbo.objective import average_cost
from smac.runhistory.runhistory import RunKey
from smac.tae.execute_func import ExecuteTAFuncArray
from C... |
2888f8302a62bef65ffb0f79e32c41d52b4542d2 | 0aa72d6449c481b8b18fc2d39a39d42ed2aef0ab | JeongHwan-dev/Crawling_with_Python | /Ch01_FundamentalCrawling/loadHTMLDocument2.py | Python | py | 300 | no_license | import requests
from bs4 import BeautifulSoup
url = "https://www.naver.com"
# url 변수에 담긴 url의 html 문서를 불러와 출력
req = requests.get(url)
# 응답 결과 출력(200: 성공, 404: 실패)
print(req.status_code)
# 불러운 html 문서의 텍스트 출력
print(req.text)
|
316a86ebb634eb8a2fcf8b7c014247c21cee7ed5 | c13314024ad3d224a25620019d1cffc00bb0f7eb | yurychu/TDD_goat | /lists/migrations/0007_list_owner.py | Python | py | 657 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-08 13:08
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency... |
2f902e2dee5b64fb5a2019de8033ecafbcfda024 | 1d292e99de97bc7e915199754c441986e92220b8 | nathan-chappell/wspd | /low_dimensions_mt.py | Python | py | 5,884 | no_license | # multithreaded...
# WSPD with dimensionality reduction and evaluation of separation in orginal
# space
import numpy as np
from matplotlib import pyplot as plt
from sklearn.decomposition import PCA
from itertools import product
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import ProcessPo... |
3e62beb567ff45b8a6d3f471e52b24c6ff41420b | 97a25e53474dfa991abe33370ef2497fb163d9ba | markotny/mgr | /app/import_cache.py | Python | py | 865 | no_license | import pickle
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from data import load_clean_df, drop_text, load_file, model_path
df = load_clean_df()
df = drop_text(df)
pickle.dump(df, open('cache/data.pkl', 'wb'))
# from bertopic import BERTopic
# from sentence_transformer... |
e04f3daf7177929fc296fb7555f6b20c786921dd | 0b3c8725a53dcef8048a0de1d32a9b260e1237c3 | fernandoAlfaro00/AssistAppDc | /AssistAppDC/settings.py | Python | py | 4,210 | no_license | """
Django settings for AssistAppDC project.
Generated by 'django-admin startproject' using Django 3.0.6.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import o... |
87ef9b2b80b3e188edae82b23e21a80c4e1b5d2b | c2c20e54adfbfef887d675c62adbd7e9ced105c0 | aws/aws-sam-cli | /samcli/local/docker/lambda_build_container.py | Python | py | 10,508 | permissive | """
Represents Lambda Build Containers.
"""
import json
import logging
import os
import pathlib
from typing import List
from uuid import uuid4
from samcli.commands._utils.experimental import get_enabled_experimental_flags
from samcli.local.docker.container import Container
LOG = logging.getLogger(__name__)
class L... |
a67767adabd7c075b204e75e932fc0a4516589bc | 9dad200f7d29eca87549328008f7a2ce1910c304 | gthreepwood/yats | /modules/yats/caldav/storage.py | Python | py | 12,512 | permissive | # -*- coding: utf-8 -*-
import json
import logging
import vobject
from datetime import datetime
from contextlib import contextmanager
from radicale import ical
from yats.shortcuts import get_ticket_model, build_ticket_search_ext, touch_ticket, remember_changes, mail_ticket, jabber_ticket, check_references, add_histo... |
e5cf96845d0dc70badb34bfe2da5bdf38c139f8b | 07d6e3605ee07e8f3c8278ef31c16fdd665e833a | prasoongoyal/PixL2R | /metaworld/supervised/create_vocab.py | Python | py | 647 | permissive | import pickle
import string
translator = str.maketrans('', '', string.punctuation)
def main():
vocab = []
with open('train.txt') as f:
for line in f.readlines():
line = line.strip()
words = line.split('\t')[-1].split()
words = [w.translate(translator).lower() for w in words]
vocab += words
with open('... |
8f50137a1b96a373203ea50dbd0927dcb4ec8312 | f788af7d872b7985e3d1508ee2e9dede1f2abf52 | qq2681121906/1803 | /07-day/石头剪刀布.py | Python | py | 331 | no_license | #1---石头
#2---剪刀
#3---布
import random
computer = random.randint(1,3)
player = int(input("请输入1---石头 2---剪刀 3---布"))
if (player==1 and computer==2) or (player==2 and computer==3) or(player==3 and computer==1):
print("玩家赢")
elif player == computer:
print("平局")
else:
print("电脑赢了")
|
d693fa9eff54105c4673a8e1c5bca93699dcb0fe | 6a309b7d2b460d5b38666876dfc34e0811621ed6 | elasticskyx/python_samples | /general/slowprogram.py | Python | py | 357 | no_license | # slow_program.py
from decimal import *
def exp(x):
getcontext().prec += 2
i, lasts, s, fact, num = 0, 0, 1, 1, 1
while s != lasts:
lasts = s
i += 1
fact *= i
num *= x
s += num / fact
getcontext().prec -= 2
return +s
exp(Decimal(150))
exp(Decimal(400))
exp(D... |
909550dbd588b0bde0fd399895bd9997af483a8d | 7ad3012a3f2532df4d0d7096d81d5b3b2db89050 | Martin-Ruggeri-Bio/Desarrollo_Personal | /python/graficos/radioBoton.py | Python | py | 515 | no_license | from tkinter import Tk, IntVar, Radiobutton, Label
def imprimir():
if sexOpcion.get() == 1:
Label(root, text="has elegido masculino").pack()
else:
Label(root, text="has elegido femenino").pack()
root = Tk()
Label(root, text="Género:").pack()
sexOpcion = IntVar()
Radiobutton(root, text="Mas... |
0bd35d9fa114f9bc5ca76f53eaaca020d515bc6e | e11185067e755c51022875c0c57a1e4672fbdefe | Sanchows/CallApp | /asyncio_server.py | Python | py | 516 | no_license | import asyncio
async def handle_echo(reader, writer):
while True:
data = await reader.read(256)
if not data:
break
writer.write(data)
await writer.drain()
print("Close the connection")
writer.close()
async def main():
server = await asyncio.start_server(
... |
9b7987ab534181eef1755483dfd507fb69e153fd | e798eb493129d8f67312cdf8f87a3571c49da98e | wd5/book_base | /book_base/settings/logging.py | Python | py | 601 | no_license | # -*- coding: utf-8 -*-
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filte... |
ae74d45eac0fa2ee17b1ef4cabafa31a18cc75f3 | e4920dc1f3f362b810235a1cf42a783d9b2bde97 | leechoongyon/SystemTrading | /SimpleTrading/simple/data/collector/stock_data_collector.py | Python | py | 6,819 | no_license | # -*- coding: utf-8 -*-
'''
Created on 2016. 8. 26.
@author: lee
'''
'''
그룹별 / 업종별 / WICS별 데이터를 수집
'''
import sys
from simple.common.util import string_util
from simple.common.util.time_util import getTodayWithFormatting
from simple.data.controlway.crawler.stock_crawler import getAllStockCdTh... |
7f57101a227ea5b30076e55cdd756f22394ba799 | 928b06de55aec93a1ad56c37ce8a20719782be4c | renovate-bot/python-game-servers | /google/cloud/gaming_v1beta/types/game_server_clusters_service.py | Python | py | 731 | permissive | # -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
c1ccf4209ed9ff038355c6d6db1aaad0e63792d0 | dafaca1e385196e3697bc8270f9b548c9ea53b2c | deepampatel/jina | /jina/executors/evaluators/running_stats.py | Python | py | 965 | permissive | """Decorators and wrappers designed for wrapping :class:`BaseExecutor` functions. """
from math import sqrt
class RunningStats:
"""Computes running mean and standard deviation"""
def __init__(self):
self._n = 0
self._m = None
self._s = None
def clear(self):
"""Reset the ... |
d9a2d2f080118e63a8bd20d9dbb596d982ff1469 | f2a3f760e940db51a645baf7b1aa6a8657740578 | petermaxil/hack36_DrBot | /app.py | Python | py | 5,043 | no_license | from flask import Flask, request
from pymessenger import Bot
import requests,json
import os
from utils import fetch_reply, age_categories, HELP_MSG, AGE_MSG, SEX_MSG, sex_categories, region_categories, REGION_MSG, SYM_MSG
import time
from pymongo import MongoClient
app=Flask("Dr_Bot")
#pymongo client for the database... |
480e1fb76ca51d41a25e86bf2ddf1c1092a7dae3 | 4c2b9216403947ce0da9d98c2112e8db122769f1 | Luminary-S/MyNote | /py/rl_fm_test.py | Python | py | 1,693 | no_license | #!/home/sgl/.virtualenvs/PT/bin/python
# coding:utf-8
'''
pycuda test
'''
from pycuda.compiler import SourceModule
from timeit import default_timer as timer
import numpy as np
import pycuda.driver as drv
import pycuda.autoinit
import torch as t
import torchvision
x = t.rand(5, 3)
y = t.rand(5, 3)
print(x)
print(t.cu... |
f5f0594ad323103c151027d2c53b32092bb96f3f | a02bc035c3fda578284cde43e709a3e0142ea0b5 | terasakisatoshi/pythonCodes | /urlLib/urlexer.py | Python | py | 224 | permissive | from urllib import request
url="http://www.google.com"
conn = request.urlopen(url)
print(conn.getheader('Content-Type'))
for key, value in conn.getheaders():
print(key,"=", value)
print(conn.status)
#print(conn.read()) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.