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 |
|---|---|---|---|---|---|---|---|---|
0a696a5243a3df25d9259ae4de352eb1f135f2a1 | d784024afd472ad618e64bb32ebdd153fdec1e0b | Sakief/RpbdSoftware | /rpbdsoft/rpbdapp/migrations/0010_auto_20210518_1607.py | Python | py | 444 | no_license | # Generated by Django 3.1.7 on 2021-05-18 10:07
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rpbdapp', '0009_remove_profile_outlet_type'),
]
operations = [
migrations.RemoveField(
model_name='profile',
name='gps_lat',... |
be33bcb625c649ce81aa6433f56c3617b4addc56 | 0189bdfb6514f7bc58e3e01a269c6db0ec077556 | vadymVolkov/bot_rev | /commands.py | Python | py | 14,173 | no_license | import db
from collections import Counter
import re
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import datetime
from config import config
import xlsxwriter
ORDER_KEY = config.order_key
def get_user(message):
user_id = message.from_user.id
user = db.get_user_byid(user_id)... |
d0a5ceb8507224d5b2a4b00a55e67ed3e3c62da3 | 8660d1ca8577e4e94037cd8f96b0dc3f96ea0a7c | vsdrun/lc_public | /co_google/444_Sequence_Reconstruction.py | Python | py | 4,113 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
https://leetcode.com/problems/sequence-reconstruction/description/
Check whether the original sequence org can be uniquely reconstructed from
the sequences in seqs.
The org sequence is a permutation of the integers from 1 to n,
with 1 ≤ n ≤ 104.
Reconstruction mean... |
fd868f1114aa22e883345858d8fe13be5cb671a4 | 1468c321425f9caf53d8f60818243d88a262c5c1 | kdaivam/leetcode | /reverse integer.py | Python | py | 372 | no_license | class Solution:
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
sign = [1,-1][x<0]
rev = 0
x = abs(x)
while x:
x, mod = divmod(x,10)
rev = rev*10 + mod
return rev*sign if -pow(2,31)... |
47d72c497b78a5cf3a5fcd3dcd498d69716eb5a7 | a7187e64c42dc80154f7aa2406e56f222a15fbee | pharnoux/client_python | /arize/examples/client.py | Python | py | 1,689 | permissive | import os
import time
import uuid
import numpy
from random import random
import concurrent.futures as cf
from arize.api import Client
ITERATIONS = 1
NUM_FEATURES = 5
arize = Client(organization_key=os.environ.get('ARIZE_ORG_KEY'),
api_key=os.environ.get('ARIZE_API_KEY'),
model_id='bench... |
13ea60cd11407ac4707118eb9c3b4a4697bba9f1 | d4bf632bd2fce8d622f34b995243377617000af0 | thalapathy64/Gaana-Downloader | /gaana.py | Python | py | 1,774 | no_license | import requests
from bs4 import BeautifulSoup
import os
from selenium import webdriver
from urllib2 import urlopen
from time import sleep
#creates directory in pc
os.mkdir('/home/ashish/Downloads/Gaana',0755)
os.chdir('/home/ashish/Downloads/Gaana/')
url=raw_input("Enter the playlist url:")
browser=webdriver.Chrome... |
44c42f65fedd6b4ba1ff0d1d08848b0b2c8b89c4 | 466bf985b350caf050b51b64ab9e800f5b673288 | NicholasWade/4900f2020project8 | /manage.py | Python | py | 629 | no_license | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cook_rest.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Impo... |
b2111ce9fcef0fce184e733ebec2118312d34c1e | d4deeb1c0e2766f04bc4c041f66702c8a5317511 | we-dont-know-algorithm/baekjoon | /Bowoo/1157.py | Python | py | 409 | no_license | import sys
_dict={}
_str = sys.stdin.readline().rstrip()
new_str = _str.upper()
for letter in new_str:
if letter in _dict:
continue
else:
_dict[letter] = new_str.count(letter)
values = list(_dict.values())
if values.count(max(values)) != 1:
print("?")
else:
for key in _dict:
... |
58e1824b255cb6b2b1b3873eb4aa039c5a95ec68 | d5963fe338a83e66bac292ba1118c240fbd7a8af | harlemnight/finance | /example/eg_read_db_toxls.py | Python | py | 2,718 | no_license | import configparser
import cx_Oracle as orac
import pandas as pd
import xlsxwriter as xlw
import os
os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'
def main(filepath):
cf = configparser.ConfigParser()
cf.read(filepath, encoding='utf-8-sig') #chinese
db_cfg = cf.items(section='db_config')
db_... |
d061207bbcdfd2d566e5b4099b71d37eb434e93c | 0c23852a526231260f4112ed203c92d46c801c42 | highing666/leaving | /src/leetcode/Coding_Interviews/max_value_of_gifts.py | Python | py | 550 | permissive | # -*- coding: utf-8 -*-
from typing import List
class Solution:
def max_value(self, grid: List[List[int]]) -> int:
for i in range(len(grid)):
for j in range(len(grid[0])):
if i == 0 and j == 0:
continue
if i == 0:
grid[i... |
b14272fff62ad758916dbe2be1185e23ccfd7b23 | f312400783fb711ca8492916346bf191d4eb824b | hschovanec-usgs/earthquake-impact-utils | /impactutils/transfer/ftpsender.py | Python | py | 10,177 | permissive | #!/usr/bin/env python
# stdlib imports
from ftplib import FTP, error_perm
import os.path
import shutil
import tempfile
# local
from .sender import Sender
class FTPSender(Sender):
'''Class for sending and deleting files and directories via FTP.
PDLSender uses a local installation of Product Distribution Lay... |
9d0536517d7f4b3691a44f1d0488b2759b0eb7c7 | 6defcb69ef8abe83499af2f85920518f8a697aa2 | sandberg-lab/aRME_and_bursting | /inference/ml_inference.py | Python | py | 1,687 | permissive | def MaximumLikelihood(vals, export_asymp_ci = False, fix = 0, export_fun = False):
from inference.moment_inference import MomentInference
from scipy.interpolate import interp1d
from scipy.optimize import minimize
from scipy import special
from scipy.stats import poisson,norm
from scipy.special i... |
24d118d186989f42e89fe9fc9c4609f194d7c5c6 | 163d436a5778bc0ddd40bc3fafc02bcb8a25bc7f | helloful/AlphaZero_Gomoku-master | /showBoard.py | Python | py | 1,399 | permissive | import pygame
EMPTY=0
BLACK=1
WHITE=2
black_color = [0, 0, 0]
# 定义黑色(黑棋用,画棋盘)
white_color = [255, 255, 255]
# 定义白色(白棋用)
class Show(object):
def __init__(self,board):
pygame.init() # pygame初始化函数,固定写法
pygame.display.set_caption("五子棋")
self.screen = pygame.display.set_mode((650, 650))
... |
1b93cce3153c4d4bb562913f57821b65d5dbb8b8 | 828d190d4d5f377677f21636155e1e6e49965833 | ledgerfoundation/flask-qldb-boilerplate | /hash_chain/app/modules/ledger/verifiable/__init__.py | Python | py | 279 | permissive | # encoding: utf-8
"""
Ledger Verifiable module
===========
"""
from hash_chain.app.extensions.api import api_v1
def init_app(app, **kwargs):
# Touch underlying modules
from . import controller
# Mount authentication routes
api_v1.add_namespace(controller.api)
|
dc352beda8ea227570c7a10cc292f568f8b75e8e | 614532de7c2a3b34932232e83fc5d8a16651a42f | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4153/codes/1675_1950.py | Python | py | 315 | no_license | t = float(input("Insira o valor em graus: "))
v = float(input("Insira a velocidade do vento: "))
if(v > 4.8):
if(t >= -50 and t <= 10):
a = (13.12 + (0.6215 * t) - (11.37 * (v ** 0.16)) + (0.3965 * t * (v ** 0.16)))
print(round(a, 4))
else:
print("Temperatura invalida")
else:
print("Velocidade invalida") |
67b7bbe3e919c7c9dd1c146eb6ee31485fb46f90 | 95a4bb61dddf405d79f14e1885db2ffad74a32be | Rickym270/rickym270.github.io | /data/projects/InterviewStudying/Medium/ThreeNumberSumMedium/Practice4.py | Python | py | 647 | no_license | #!/usr/bin/python3
def threeNumberSum(array, targetSum):
array.sort()
triplets = []
for i in range(len(array) - 2):
lp = i + 1
rp = len(array) - 1
while lp < rp:
currentSum = array[i] + array[lp] + array[rp]
if currentSum == targetSum:
triplet... |
0a953f86c00a89f016a54415e5ae8ce4ea583b32 | 1fd305bf6927e2fb168dc3db73a303907f8a2ae3 | dtekluva/Collection_of_python_apps | /uncharted/random test.py | Python | py | 206 | no_license | ##import random
##
##x=range(1,500,1)
##
##y=random.choice(x)
##print (y)
f = open("twist.txt","r") #opens file with name of "test.txt"
myList = []
for line in f:
myList.append(line)
print(myList)
|
64f3c8901023ca649f27ee0e57284a3b00d132d7 | 23ff1e6e8f5da54eaf74ba3d81341e109270afd4 | fhk/globeloc | /setup.py | Python | py | 2,701 | no_license | from setuptools import setup, find_packages
packages = [
"attrs==19.3.0",
"backcall==0.1.0",
"bleach==3.1.4",
"certifi==2020.4.5.1",
"cffi==1.14.0",
"chardet==3.0.4",
"click==7.1.1",
"click-plugins==1.1.1",
"clickclick==1.2.2",
"cligj==0.5.0",
"cloudpickle==1.4.1",
"conn... |
e5711c2e6c2d2e0482d889f79e3a701a53ccf211 | d65dd24ab6ef549322f8bf9674325debbd4d1418 | teepark/pathfinder | /test/functional/test_finder.py | Python | py | 11,447 | permissive | #!/usr/bin/env python
# vim: fileencoding=utf8:et:sta:ai:sw=4:ts=4:sts=4
import Cookie
import sys
import unittest
import urllib
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import pathfinder
#
# mocking the web (http://is.gd/gv1kh6)
#
def fake_wsgi_request(finder, me... |
9d7e3194ca52f30441f916e68fad413ebb21d250 | 93290f65e83496e41e35a29381cc8323eaca57aa | mkhamzanov/backendschool | /app/get_import_valid_functions.py | Python | py | 2,970 | no_license | from datetime import datetime,date
from collections import Counter
from time import time
import json
def apartment_valid(t):
for x in t['citizens']:
if not isinstance(x['apartment'],int):
return False
if x['apartment']<0:
return False
return True
def citizen_id_valid(t)... |
d97ab1f9bb07c62f183ddda79ede093d5add50c5 | 5c8c8a77c8fa578dd349994a4676efa56f6e5bb7 | spcl/substation | /substation/dtypes.py | Python | py | 924 | no_license | """ Data types and support for DaCe/NumPy/PyTorch. """
# Avoid further imports to be imported along with this file
import dace as _dace
import numpy as _np
import torch as _torch
# Default type configuration
np_dtype = _np.float32
if np_dtype == _np.float32:
dace_dtype = _dace.float32
torch_dtype = _torch.fl... |
86936409c4f855850e64c48d49768b56a24dace6 | bf4e4f53667cbeebb01811360e3eabc1e0812dc1 | n1k0/github3.py | /tests/test_repos.py | Python | py | 22,228 | permissive | import os
import github3
from tests.utils import (expect, BaseCase, load)
from mock import patch
class TestRepository(BaseCase):
def __init__(self, methodName='runTest'):
super(TestRepository, self).__init__(methodName)
self.repo = github3.repos.Repository(load('repo'))
def setUp(self):
... |
29a9b42321b2fb8c9fbfafef54dc1f1cb556a88f | 107777edb6578de7c87f34693308b0549d9c9057 | extratone/i | /source/WebKit2-7601.1.46.140/Scripts/webkit/messages.py | Python | py | 22,763 | permissive | # Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and... |
0675274a4550147c662b565bbd8a9f69693b0165 | 67ef83e9184e5093312429be9e5cdcf5a7ce2190 | Internet-Connectivity-MQP-2019/DNS_Testing | /aggregate_state_to_state.py | Python | py | 2,080 | no_license | #!/usr/bin/python3.4
import sys
import csv
from statistics import mean, median
def aggregate(results_filename, reliable_rec_filename, reliable_auth_filename, geolocation_filename):
reliable_ips = []
with open(reliable_rec_filename, 'r', newline='\n') as f:
r = csv.reader(f)
next(r, None)
... |
13fc3194b83fb0dc58185aa420bc3f6350b95e96 | 97cf65b598ad30a7b1e743da0ed2c573fcd087ee | AlexanderFabisch/distance3d | /examples/gjk/plot_capsules.py | Python | py | 1,492 | permissive | """
==================================
Distance between capsules with GJK
==================================
"""
print(__doc__)
import time
import numpy as np
import matplotlib.pyplot as plt
import pytransform3d.plot_utils as ppu
import pytransform3d.transformations as pt
from distance3d import gjk, colliders
from dist... |
54486ec0614e3fff836885f2fa01e01eb3e3d2a6 | 825b36df98febaac082c254729e2c258f9747936 | lakiw/cripts | /cripts/email_addresses/email_address.py | Python | py | 2,390 | permissive | import uuid
from mongoengine import Document, StringField, UUIDField, ListField
from django.conf import settings
from cripts.core.cripts_mongoengine import CriptsBaseAttributes, CriptsSourceDocument
from cripts.core.cripts_mongoengine import CriptsActionsDocument
class EmailAddress(CriptsBaseAttributes, CriptsSourc... |
fe198961d3dd7c1c40c0cdc7ad2322e3b2f02723 | 948ab83de8c039244b38ce6000b2aa89051c691a | MitsuruFujiwara/DeepLearningExamples | /BankMarketing/MLP_GridSearch.py | Python | py | 1,119 | no_license | import pandas as pd
import numpy as np
from sklearn.neural_network import MLPClassifier
from sklearn.model_selection import GridSearchCV
from sklearn.externals import joblib
from sklearn.preprocessing import label_binarize
def main():
# load Data
df = pd.read_hdf('db.h5', key='train', mode='r')
# set dat... |
f95739822101e7248afd72dc12c12cb0843a6b1e | 99354f7329abeb6a33f1fe6dd35b755442a61c2a | ForeverDreamer/scrapy_learning | /scrapy-extracting-structured-data/m1_d06_un_programme_crawler/m1_d06_un_programme_crawler/middlewares.py | Python | py | 3,631 | no_license | # -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class M1D06UnProgrammeCrawlerSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not define... |
3fad10405b9140728a364ab60cff9cb73cb643a8 | f72d4d3beda7685fbfc71821df1611a4f10f5d95 | ArtyomKaltovich/some_algorithms | /count_sort.py | Python | py | 281 | no_license | def count_sort(array: list):
counts = [0] * 10
for a in array:
counts[a] += 1
return [i for i in range(len(counts)) for _ in range(counts[i])]
if __name__ == '__main__':
n = int(input())
array = map(int, input().split())
print(*count_sort(array))
|
18d331d00ff6eaea33a822717d767b99213feafe | 9464fae944b9e1d91b8409839a64d6aec140da16 | EZUSoft/AnotherDXF2Shape | /fnc4all.py | Python | py | 9,947 | no_license | # -*- coding: utf-8 -*-
"""
/***************************************************************************
A QGIS plugin
AnotherDXF2Shape: Convert DXF to shape and add to QGIS
copyright : (C) 2020 by EZUSoft
email : qgis (at) makobo.de
***********************************... |
8bf773146b25a88afcd83c3e1dc04d171677de03 | c462296dcc73ab59b6bbf4c8ffb49379e5f772d9 | Amberyt/HunterGang | /userbot/plugins/translate.py | Python | py | 1,356 | permissive | """ Google Translate
Available Commands:
.tr LanguageCode as reply to a message
.tr LangaugeCode | text to translate"""
import emoji
from googletrans import Translator
from userbot.utils import admin_cmd
@borg.on(admin_cmd("tr ?(.*)"))
async def _(event):
if event.fwd_from:
return
if "trim" in event.... |
27825bdb9b0fd0c5084edda5899a93629a8692f6 | acd0ca25a08fdbf778c2a15dc430f15c5294bbe2 | mhabib5073/hotelapp | /HotelProj1/HotelApp/views.py | Python | py | 505 | no_license | from django.shortcuts import render
from .models import *
from django.views.generic import *
class Index(TemplateView):
template_name = 'index.html'
class Table(ListView):
model = Customer
template_name = 'table.html'
class Create(CreateView):
model = Customer
fields = ('__all__')
template_... |
4a0d0512bd5f53fd35de0090ef83cf95ea11c606 | f14f17c5a3673583e40416d4c06306313a0f59a3 | GuND0Wn151/Discord_bot_helper | /functions/memes.py | Python | py | 469 | no_license | import praw
import random
def meme_generator():
memes = praw.Reddit(
client_id="g_DgbALQYuBhGGxiR3NcPQ",
client_secret="TxT0093iZVDEjzUz9wnL4LGt6YKZYQ",
username="GuND0Wn15",
password="mahesh31",
user_agent="memer",
)
bot = memes.subreddit("memes")
... |
668d4c4aac8773aaad9954737ccc649fe44cabfb | 462ebf84062bebd84d94ee7518cd884e221e55ed | gumupaier/flute | /flute/apps/amber/const.py | Python | py | 605 | permissive | # -*- coding: utf-8 -*-
# @Time : 2020/12/11 10:13 上午
# @File : const.py
VERSION_IMAGE_MAP = {
'storaged': {
'nightly': 'vesoft/nebula-storaged:nightly',
'1.2': 'vesoft/nebula-storaged:v1.2.0',
'1.1': 'vesoft/nebula-storaged:v1.1.0'
},
'metad': {
'nightly': 'vesoft/nebu... |
a3c974105574b1d9f65e706fed0bfecf969603e7 | 59a6eed690d414236a6292e1759be05efd961ab8 | kaypee90/imcsv | /tests.py | Python | py | 1,889 | permissive | import io
import csv
import unittest
from imcsv.imcsv import generate_temp_csvfile
from imcsv.exceptions import InconsistentCsvDataError, EmptyHeadersError
class TestImcsvCreator(unittest.TestCase):
def test_generate_temp_csvfile_with_valid_data(self):
headers = [
"Date",
"Month",
... |
40dd22f7f1b733e6e03182f656350556fa058f04 | b74429a486037e584a193f3335eae9d1e496932b | ichoukou/58spider | /pro_files/url_list/work_list.py | Python | py | 2,147 | no_license | # -*- coding:utf-8 -*-
import os
import os.path
import re
import sys
import codecs
# from ..IOutils import rtfile_input
reload(sys)
sys.setdefaultencoding('utf-8')
# 这里放着你要操作的文件夹名称
path = 'F:\\project\\project58\\url_list\\'
files = os.listdir(path.decode('utf-8'))
# sed_r_list = []
res_list = []
for file in fil... |
d552ef47e0a6e8c63fecdc9327425b990e2c88da | b30f2a1d948b7e023e106f2665aec11fb0b0b1a4 | pombredanne/pydigger.com | /PyDigger/website.py | Python | py | 9,768 | permissive | from flask import Flask, render_template, redirect, request, url_for, Response, jsonify, g, abort
import datetime
import hashlib
import json
import logging
import logging.handlers
import math
import os
import pymongo
import time
import re
import PyDigger.common
from PyDigger.common import cases, get_stats_from_cache, g... |
199198523f0706f07dd3cfdf4de7c5bf314cd1c6 | cd5442d17110ffc40902352442c850184a00bd3b | enriquefariasrdz/Python | /PLURALSIGHT_BEGINNERS/lib/python3.9/site-packages/holoviews/tests/plotting/matplotlib/testrenderer.py | Python | py | 8,144 | no_license | # -*- coding: utf-8 -*-
"""
Test cases for rendering exporters
"""
from __future__ import unicode_literals
import os
import sys
import subprocess
from collections import OrderedDict
from unittest import SkipTest
import numpy as np
import param
from holoviews import (DynamicMap, HoloMap, Image, ItemTable, Store,
... |
b520cf69804c44774b049462fb94364a8f75fc4d | a54390259085fa47aee7e7e7229cea89cf9d2e83 | saimihirj/Bioinformatics | /Labs/week4.py | Python | py | 6,128 | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 18 14:23:06 2021
@author: saimihirj
"""
# Bioinformatics - WEEK 4
# Which DNA Patterns Play The Role of Molecular Clocks?(Part 2)
# Input: A set of kmers Motifs
# Output: Count(Motifs)
def CountWithPsuedocounts(Motifs):
count = {} # initializ... |
dc5166e235342b0085b22ab18c5c67583e1f9ca2 | 4714d7ba9c6357d75bbfdb5bc5c8ccb9d24fc22b | grantsimmons/viz-soc | /eugenics/eugenics_viz.py | Python | py | 3,264 | no_license | import geopandas as gpd
from math import ceil
from shapely.geometry import Point, Polygon
import matplotlib.pyplot as plt
import pandas as pd
from math import ceil
data = pd.read_csv('sterilization.csv', index_col='state')
usa = gpd.read_file('zip://cb_2018_us_state_20m.zip')
#usa = usa.to_crs({'init' :'eps... |
ebe235d2e3a206839f5a8be629c636f190216c77 | 0a939ff4c8744809423eaf705d44128ed4edd805 | ZacharyZampa/CourseAutoScheduler | /RegistrationScript.py | Python | py | 3,109 | no_license | import datetime
import openpyxl
import mechanize
import os
# Process the CRN codes from a supplied worksheet
os.chdir("C:\\Users\\zampaze\\Documents\\School") # change working directory to where spreadsheet is
wb = openpyxl.load_workbook('ClassPlan.xlsx') # load in the workbook
sheet = wb['Original'] # choo... |
0de6e4bced02feac53c415e43e4d67a5c9b49bd6 | dfa17342c9689aa9a733e24479ec3ef5d1ff18a8 | hanguangchao/python_learn | /web/selenium3.py | Python | py | 500 | no_license | # -*- coding: utf-8 -*-
"""
Waits
"""
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
driver.get('https://www.lagou.com/zhaopin/houduankaifa... |
7ce036104dc56ce5746e6fc29637e1ff5b254310 | 401965e07b4fdc934a6a4624b52c5f3edfe69431 | buntynitin/ICPS-Project | /main.py | Python | py | 1,377 | no_license | import os
from flask import Flask, send_from_directory, request, jsonify
from model import DecisionTreeClassifier, KNNClassifier, NeuralNetClassifier
import numpy as np
app = Flask(__name__, static_folder='ui')
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def serve(path):
if path != "" and o... |
8d8fa608f110c31876fa0e33defb6c39bcce3532 | dfd40ce90e8a96d7ed3a653fea412f4a6e79768a | idiap/nnsslm | /common/datasets.py | Python | py | 48,419 | permissive | """
datasets.py
Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/
Written by Weipeng He <weipeng.he@idiap.ch>
This file is part of "Neural Network based Sound Source Localization Models".
"Neural Network based Sound Source Localization Models" is free software:
you can redistribute it and/or modify i... |
f46c4fb9a5912e0d37488dac2ebe741631e21b4d | cce2272776fc7409838e089172ac678e47c36b75 | zhutianwei/AIND-Sudoku | /PySudoku.py | Python | py | 1,920 | permissive | import sys, os, random, pygame
sys.path.append(os.path.join("objects"))
import objects.SudokuSquare
from utils import *
from objects.GameResources import *
def play(values, result, history):
assignments = reconstruct(result, history)
pygame.init()
size = width, height = 700, 700
screen = pygame.disp... |
b7c4656207222c8de77db94462468371004feb30 | a4208e2f157d14e5fe57a676b812f2c49814f986 | Fuchaoxin/fcx | /test_cases/interface_cases/user_manage/test_cooperation_queryUserWithPage.py | Python | py | 1,242 | no_license | # -*- coding: utf-8 -*-
import requests
import pytest
import allure
from base import config
import json
from base.AssertUtil import AssertUtil
@allure.step("接口test_cooperation_queryUserWithPage")
def test_cooperation_queryUserWithPage():
payload1 = {
'accessToken':config.TOKEN,
"page":{"pageNum": 1,... |
e7067a7f20a8d5dbd768d8dc8f55ee35809b1594 | b5af18fff09c93f4155404d1729e2733402f9443 | ledvir26/biblioteca | /applications/lector/forms.py | Python | py | 635 | no_license | from django import forms
from applications.libro.models import Libro
from .models import Prestamo
class PrestamoForm(forms.ModelForm):
class Meta:
model = Prestamo
fields = ('lector','libro',)
class MultiplePrestamoForm(forms.ModelForm):
libros = forms.ModelMultipleChoiceField(queryset=Non... |
ac8c0b2d30e4cc9d376a2de7d5621cbce9383d50 | 83a1b91c6eb83a1e361ceb4f2230e7695b5b5f43 | evanbiederstedt/clockwork | /python/clockwork/tests/db_test.py | Python | py | 75,204 | permissive | import unittest
import copy
import datetime
import imp
import os
import shutil
import pyfastaq
from operator import itemgetter
from clockwork import db, db_connection, db_maker, db_schema, isolate_dir, mykrobe, reference_dir, utils
modules_dir = os.path.dirname(os.path.abspath(db.__file__))
data_dir = os.path.join(mod... |
f7ef726021b023dc8eb2600d994e0e202abfb5ea | 2fe772c133ae1c43de680bd19e79498f8808efcb | mikeengland/fireant | /fireant/queries/builder/dimension_latest_query_builder.py | Python | py | 2,059 | permissive | import pandas as pd
from fireant.dataset.fields import Field
from fireant.utils import (
alias_for_alias_selector,
immutable,
)
from .query_builder import QueryBuilder, QueryException, add_hints
from ..execution import fetch_data
from ..sql_transformer import make_latest_query
class DimensionLatestQueryBuild... |
9d18e7f3d9db7172e6e1a672b303d411463220a8 | f36c3f83e98973fd09b36d7ac50c96508fc73ad0 | akshitagarg15/IMS_GUI | /inventory_data/screens/AddEmployeeInfo.py | Python | py | 10,236 | no_license | from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from dao import Connections
from utilities import *
import datetime
import os
import sys
class AddEmployeeInfo(QWidget):
def __init__(self):
super().__init__()
self.PrepareScreen()
def PrepareScreen(self):
try:
self.se... |
4a4667e4732486ec064c05afa435900aad5bb0f3 | aa9df731ac14285b35bbf931e88c3589a6c22fd8 | Azure/azure-sdk-for-python | /sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_assets_operations.py | Python | py | 50,800 | permissive | # pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRe... |
0809cb9aafeef8f0d1a26982c7c28acef2f5c4fc | ff41e459ecd0592ee006cb7020f49549ffc2deaf | chitianhao/trafficserver | /tests/gold_tests/tls/tls_keepalive.test.py | Python | py | 4,913 | permissive | '''
Use pre-accept hook to verify that both requests are made over the same TLS session
'''
# 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 li... |
9ae19456db0c20510f07bbe60ecb43faeff6316c | 29af47af9850944a7622ee304e57f1945ad8acbe | guigue/CRAAM-Instruments | /SstModulesTccRafaelFrederico/sst_data_capture.py | Python | py | 3,605 | no_license | import time as t
import traceback
from lxml import etree
from datetime import datetime
from termcolor import colored
from email.generator import Generator
from email.mime.text import MIMEText as MT
def extract_ring_list_values(sst_type, sst_date, sst_time, ring_list, clock):
index = 0
count_errors = 0
rin... |
3d6ef0976200f00054cfe51b7c4c883db16037ae | ed6c3553303cf6fc087614b03a410518192aa001 | camclean/ZprimeCombo13TeV | /runCombo/combination.py | Python | py | 7,592 | no_license | #!/usr/bin/env python
key_ = "zpn"
channels = ['muo', 'ele']
signals = ['zpn', 'zpw', 'zph', 'kkg']
sig_mass = {
'zpn': [500, 750, 1000, 1250, 1500, 2000, 2500, 3000, 3500, 4000],
'zpw': [500, 750, 1000, 1250, 1500, 2000, 2500, 3000, 3500, 4000],
'zph': [500, 750, 1000, 1250, 1500, 2000, 2500, 3000, 3500, 4000]... |
91b5152caed3711e4f734d2bdcc9c22076932c5f | 08b457721935d0e5ab2c1f61be68dc74dacca12f | blairdrummond/flask-s3-viewer | /flask_s3_viewer/aws/session.py | Python | py | 1,269 | permissive | import boto3
import logging
from botocore.errorfactory import ClientError
class AWSSession:
def __init__(
self,
*,
profile_name=None,
region_name=None,
secret_key=None,
access_key=None,
use_ssl=True
):
self.runnable = False
self.profile_... |
c91c003b4e5956afd29f8987dab2cda7bde6f8f6 | d45969b58caf3aa844268d39a59d30f16a3b940b | luke-orden/napalm-yang | /napalm_yang/models/openconfig/bgp/peer_groups/peer_group/afi_safis/afi_safi/ipv6_labeled_unicast/prefix_limit/state/__init__.py | Python | py | 100,851 | permissive |
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from decimal import Decimal
from bitarray import bitar... |
aaad15b32d0b27dee3c231052fd04d566f39b14b | b0069973e91ff4dec5065ea7db27342d5d6b7607 | pybites/pyplanet-django | /articles/migrations/0007_auto_20170716_2241.py | Python | py | 506 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-16 22:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0006_auto_20170716_2240'),
]
operations = [
migrations.AlterFie... |
2ac3a9145af14c632a649b6cbec36bcdd678e4f0 | dece3593b40b5604531bf4c3fbb716d0f66856e8 | PureStorage-OpenConnect/py-pure-client | /pypureclient/flashblade/FB_2_10/models/object_store_access_policy_action.py | Python | py | 3,426 | permissive | # coding: utf-8
"""
FlashBlade REST API
A lightweight client for FlashBlade REST API 2.10, developed by Pure Storage, Inc. (http://www.purestorage.com/).
OpenAPI spec version: 2.10
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import t... |
262e5f0fa220beb44400693c24e0e4dc647fe91b | 290baf2bb61daf84497705f8d6adfcaa770d35f1 | SpielerNogard/The-Zenaria-Chronicle-II- | /GameAssetsumgeschrieben/Tempel_Boden.py | Python | py | 287 | no_license | import pygame
class Tempel_Boden(object):
def __init__(self):
self.IMG1 = pygame.image.load("Assets/Tempel Boden.png")
self.actual_image = self.IMG1
def paint(self,screen,pos_x,pos_y):
screen.blit(self.actual_image,(pos_x,pos_y))
|
d58907cb05a127d91d3839b87e12550a654231bc | 11e2236307deb14a2f833648936a7273895a1ffa | st9007a/LocationTracker | /eval.py | Python | py | 2,895 | no_license | #!/usr/bin/env python3
import sys
import os
import numpy as np
from sklearn.metrics import accuracy_score
from utils.tfpkg.models import Evaluator
from utils.io import read_pkl
from utils.location import distance
model_path = sys.argv[1]
nodes = read_pkl('tmp/nodes.pkl')
loc_db = read_pkl('tmp/location.pkl')
candid... |
bb3058bff1a717bd9292cae15cb8f050aa480b3f | 73e72149b3714f8e458a9d3a7a815a7c3a462600 | NateRobinsonS/home-assistant | /homeassistant/components/proximity.py | Python | py | 9,431 | permissive | """
Support for tracking the proximity of a device.
Component to monitor the proximity of devices to a particular zone and the
direction of travel.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/proximity/
"""
import logging
import voluptuous as vol
... |
13734cb2ba3e7459ce4dfdc8c645341d893a4bef | 1f7ca9a5a09ebea3ba8648849180868118851aa1 | mjustinz86/CIS2348JustinoCortez | /Homework3/Zylab10.15.py | Python | py | 1,006 | no_license | # Justino Cortez ID 1615245
class Team:
def __init__(self):
self.team_name = 'none'
self.team_wins = 0
self.team_losses = 0
def get_team_name(self, team_name):
self.team_name = team_name
def get_team_wins(self, team_wins):
self.team_wins = team_wins
... |
08a394ce0b1e7a010402d19eb9a6648cf33d581d | 44947e991da5ab066d76c043bc915f00fdba3b1f | shuoshuren/Django | /test1/booktest/admin.py | Python | py | 691 | no_license | from django.contrib import admin
from .models import BookInfo, HeroInfo
# Register your models here.
class HeroInfoInline(admin.TabularInline):
model = HeroInfo
extra = 3
class BookInfoAdmin(admin.ModelAdmin):
# 展示列表
list_display = ['id', 'btitle', 'bpub_date']
# 过滤字段
list_filter = ['btitle'... |
e6cbb5aa52496deb1755bde5208938ead8eb6e10 | 76a6977711493f78b57fc575defd7cc4d5596813 | hashmapybx/leetcode- | /array/Leetcode38_CountAndSay.py | Python | py | 893 | no_license | # _*_ coding: utf-8 _*_
# @Time : 2021/6/27/0027 15:30
# @Author : 流柯
# @Version:V 0.1
# @File : Leetcode38_CountAndSay.py
# @desc :
# leetcode 38题 描述数字字符串 12 --》 1112 表示的是一个1, 1个2
def get_next(res):
# dict_ = {res: 1}
# res = dict_.get(res) + res
length = len(res)
num = 1
first = res[0]
a... |
abb87acaed6ee6f12273036fd2bae8a3f3d4ef8f | 5828593ac9e6d8001a1c58f78a64499be26ccfd8 | AlTsayun/py | /impl/TextFilesToPdfs.py | Python | py | 1,276 | no_license | from fpdf import FPDF
import os.path
import textwrap
from FileWriterPermissiver import canWriteToFile
def text_to_pdf(text, filename):
a4_width_mm = 210
pt_to_mm = 0.35
fontsize_pt = 10
fontsize_mm = fontsize_pt * pt_to_mm
margin_bottom_mm = 10
character_width_mm = 7 * pt_to_mm
width_text ... |
37fd20dd5358fbb9b8cbb291509ece9337ebc5da | 62424bcaee759fadc7760ab6e77cf4168d33bec7 | carlicarlitos/usm-memoria | /codigo/twitter/101_conseguir_texto.py | Python | py | 1,585 | no_license | import pymongo
import os
import random
from twython import Twython
import pandas as pd
import time
import dicttoxml
THIS_FOLDER = os.getcwd()
#conexion mongo
myclient = pymongo.MongoClient("mongodb://localhost:27017/")
mydb = myclient["twitter-memoria"]
coleccion_completa = mydb["csv_all"]
bd_hilos = mydb["hilos"]
... |
89f1587f920c17b8d874a4dc4caa52c7e824ceeb | 811833f933624f892f310b543eaed238f7e768bb | Prefest2018/Prefest | /benchmark/goodweather/testcase/firstcases/testcase12_015.py | Python | py | 4,624 | no_license | #coding=utf-8
import os
import subprocess
import time
import traceback
from appium import webdriver
from appium.webdriver.common.touch_action import TouchAction
from selenium.common.exceptions import NoSuchElementException, WebDriverException
desired_caps = {
'platformName' : 'Android',
'deviceName' : 'Android Emulat... |
c99807fce332da9b4d1709f22f49fa4d35121637 | 8d4d4e493d4de7d4407a19ebe9d36a6139d09f90 | Lucifer-Kim/crawling_overwatch | /overwatch/sc/sc/pipelines.py | Python | py | 282 | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class ScPipeline(object):
def process_item(self, item, spider):
return item
|
2360b81c31efad00614835558bdd1f2f9dd075d8 | aae7943c3d8f3f26e7c46263bcb2aecfbcbda0c4 | godlikepanos/varius | /proto/threading_asio/gen.cfg.py | Python | py | 300 | no_license | sourcePaths = ["."]
includePaths = ["."]
executableName = "test"
compiler = "g++"
compilerFlags = "-c -pedantic-errors -pedantic -ansi -Wall -Wextra -W -Wno-long-long -pipe -O0 -g3 -pg -fsingle-precision-constant"
linkerFlags = "-rdynamic -Wl,-Bstatic -Wl,-Bdynamic -lpython2.6 -lboost_thread"
|
8f091b7e163ad383d458b9f2a45aee02f662908f | 0c9f627dd61e18ba9d605ae5b8e1c19deb9169dc | Kamalrathi49/django-UserAuth | /project/myapp/migrations/0005_auto_20210929_1434.py | Python | py | 955 | no_license | # Generated by Django 3.2.6 on 2021-09-29 09:04
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('myapp', '0004_customuser_image'),
]
operations = [
migrations.AddField(
model_name='c... |
342fd115173e058865b5b87e742209558be4a994 | fd19a4c72aad1bbf97573b78a062014631f45c4e | thunderrabbit/some-old-bs-journal | /index.py | Python | py | 349 | no_license | #!/usr/bin/env python
import sys
import cgi
import os.path # os.path - The key to File I/O
import pickle
# the classes below are written for python_file_journal
sys.path.append("classes")
import template
import db
field = cgi.FieldStorage()
print "Content-Type: text/plain\n\n"
print 'Planning to create a python vers... |
0bb7c107e3e0f0d4e2ebd063419f80964f697af5 | a215dea1d969027c1f92f8e3c5948622806af605 | Danidude/noisy | /examples/simple_lts.py | Python | py | 3,084 | no_license | #!/usr/bin/python
"""
A simple (and slow) case of a LTS (local thompson sampling) with a normal distribution.
"""
import math
import random
class LTS:
def __init__(self,N, init_mu, init_sd, observation_noise):
"""
init_variance and observation_variance are in there standard deviation form.
... |
5db99da65df33c41278e2c1b2ccfd249b4d72fa7 | 50150f23efbd530fd58dba37ac97325f8e10837e | noellebrowne/todo2 | /todo/test_views.py | Python | py | 1,823 | no_license | from django.test import TestCase
from .models import Item
from django.shortcuts import get_object_or_404
class TestViews(TestCase):
def test_home_page_lists_todo_items(self):
page = self.client.get('/')
self.assertEqual(page.status_code, 200)
self.assertTemplateUsed(page, "todo_list.html")
... |
66c6bb8dcb22d5c73741b85eebf844607f98288a | 3b77a63ba954d7446118497a922c1c87f04a4505 | Busaka/excellence | /src/membership/urls.py | Python | py | 2,314 | permissive |
"""Membership URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... |
2651edb1114a5056a4a0a10d12c09d775a26bb5c | a15b4e022e76ff7eb883311271590d29e0d3a754 | Alan-ZhangBin/hackathon-ocw | /Crawler/yixi/yixi/spiders/spider_yixi.py | Python | py | 2,323 | no_license | # -*- coding: utf-8 -*-
import scrapy
import time
import re
from yixi.items import YixiItem
from selenium import webdriver
class YixiSpider(scrapy.Spider):
name = "yixi"
allowed_domains = ["yixi.tv"]
start_urls = ["http://yixi.tv/lecture/"]
def __init__(self):
scrapy.Spider.__init__(self)
... |
0192c52422d815508fbbad4964ae3f1ec59da67b | 6526c2987d298083916a8e14dfbdb2b5e3bf9a2f | squirrelo/biom-format | /setup.py | Python | py | 3,479 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Copyright (c) 2011-2013, The BIOM Format Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this s... |
55ede9b5a4ea265c402a800fb250d2e030b87889 | e8e39ce88b9bdd3465316406f10a67cf845789fc | EQ4/scipy | /scipy/optimize/_hungarian.py | Python | py | 9,295 | no_license | # Hungarian algorithm (Kuhn-Munkres) for solving the linear sum assignment
# problem. Taken from scikit-learn. Based on original code by Brian Clapper,
# adapted to NumPy by Gael Varoquaux.
# Further improvements by Ben Root, Vlad Niculae and Lars Buitinck.
#
# Copyright (c) 2008 Brian M. Clapper <bmc@clapper.org>, Gae... |
0db13a1a5c9b1c07b3b06fb13f39b75163ec873c | 66713a1e4eefeedeca1af86537d1ac3de1e555bf | drmoose/meson | /mesonbuild/cmake/executor.py | Python | py | 16,813 | permissive | # Copyright 2019 The Meson development team
# 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 ... |
18772f1280f7d4205acd1fdbcdc0f526b04d909e | 201ed8c261a7189ca7fff7a01715f5a6839d5eab | Mchzks/BHP | /Chapter 6 - Extending Burp Proxy/buzzer.py | Python | py | 2,238 | no_license | from burp import IBurpExtender
from burp import IIntruderPayloadGeneratorFactory
from burp import IIntruderPayloadGenerator
from java.util import List, ArrayList
import random
class BurpExtender():
def registerExtenderCallbacks(IBurpExtender, IIntruderPayloadGeneratorFactory):
self._callbacks = callbacks... |
f0bc777ca49c49fb92da7f16a50a57ddb1f544b2 | 265317cbcc9361fc357131e6de592d98de0e87b2 | fanqi0312/MachineLearning | /DeepLearning/NN/cifar/data_utils.py | Python | py | 6,897 | no_license | import pickle as pickle
import numpy as np
import os
#from scipy.misc import imread
def load_CIFAR_batch(filename):
""" load single batch of cifar """
with open(filename, 'rb') as f:
datadict = pickle.load(f, encoding='latin1')
X = datadict['data']
Y = datadict['labels']
X = X.reshape(10000, 3, 32,... |
c03952cb4fff59601bc8a3ef7f5429b4f63a8184 | de207a1ddab26f9b442982cc38998e758b2a28fa | nsa32752/BOJ | /1946.py | Python | py | 352 | no_license | import sys
T = int(input())
for x in range(T):
N = int(input())
new = []
man = 1
for y in range(N):
new += [list(map(int, sys.stdin.readline().rstrip("\n").split(" ")))]
new.sort()
bound = new[0][1]
for l in range(1,N):
if bound > new[l][1]:
bound = new[l][1]
... |
2b297f0e5274c9edb8eb2016003c878ded8df74b | d96c5f23849bb19f8d2fc5ef6b2665eac7988aa2 | rodrigocosin/ML_automator | /Código_final_gerado_pela_solução_após_processamento_da_base_compras_online.py | Python | py | 73,387 | no_license | # Importando Modulos e Pacotes
import numpy as np
import pandas as pd
from tabulate import tabulate
import sklearn.model_selection as model_selection
from sklearn.tree import DecisionTreeClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.neighbors import KNeighborsClassifier
from sklear... |
b57ba00f42c566145cd6bbb596774019d63399cf | ba0096adcf98e7bcbf14a6fc43acc3b336abb108 | StephanieMaia15/Python | /desafio044_desconto_produto.py | Python | py | 817 | no_license | #calculando o valor a ser pago de acordo com a forma de pagamento
vatual = float(input('Digite o valor do produto: '))
print('''Formas de pagamento:
[ 1 ] Dinheiro
[ 2 ] Débito à vista
[ 3 ] 2x Cartão de Crédito
[ 4 ] 3x Cartão de Crédito''')
opcao = int(input('Qual a opção de pagamento? '))
if opcao == 1:
total ... |
5c7af75f528ddf05e109a153296951bb5400513e | 2fb454be529cc10a50ebe1495e4d4d6fb483c6f5 | chielpeters90/kubespawner | /kubespawner/spawner.py | Python | py | 49,505 | permissive | """
JupyterHub Spawner to spawn user notebooks on a Kubernetes cluster.
This module exports `KubeSpawner` class, which is the actual spawner
implementation that should be used by JupyterHub.
"""
import os
import json
import string
from urllib.parse import urlparse, urlunparse
import multiprocessing
from concurrent.fut... |
50d81ab40a0f570155d9adc6a98f3794b0e760d4 | a284e77b0ae58115184982e85da58819a33c5321 | estrehle/aries-cloudagent-python | /aries_cloudagent/protocols/out_of_band/v1_0/manager.py | Python | py | 47,822 | permissive | """Classes to manage connections."""
import asyncio
import json
import logging
from typing import Mapping, Sequence, Optional
from ....connections.base_manager import BaseConnectionManager
from ....connections.models.conn_record import ConnRecord
from ....connections.util import mediation_record_if_id
from ....core.... |
80599b9e8e96a4217f1afcc69d4a21eb0cbdb9a4 | 308544ba18fbc9012c1e4872017fa97fae6c70db | wavestoweather/enstools-compression | /enstools/compression/analyzer/analyze_data_array.py | Python | py | 7,580 | permissive | """
This module provides functions to find the compression specification that corresponds
to a given data array and a set of compression options.
The main function, `analyze_data_array`, takes a `data_array` and an `options` object
and returns the compression specification and metrics computed with the compressed data... |
fc535aa71dc04183dbb1bebabe70e38ca43a0a3e | ecea3fd06224eceaaabdb30a459c9e019be81d90 | randlet/qatrackplus-ci | /qatrack/qa/tests/__init__.py | Python | py | 332 | permissive | from qatrack.qa.tests.test_views import * # NOQA
from qatrack.qa.tests.test_models import * # NOQA
from qatrack.qa.tests.test_tags import * # NOQA
from qatrack.qa.tests.test_utils import * # NOQA
__test__ = {
"views": ["test_views"],
"models": ["test_models"],
"utils": ["test_utils"],
"tags": ["tes... |
77f8fdf30fe3c1d99b246c82e2e66b10aa198a33 | a681347edc7d4de1ef8519e093036230189ea29c | abhisheksp/monopoly | /adapter/adjudicator.py | Python | py | 682 | no_license | import adapter.game_state
from utils.context_factory import context_factory
class Adjudicator:
@staticmethod
def runGame(player_1, player_2, dice_rolls=None, chance_cards=None, community_chest_cards=None):
count = 0
context = context_factory(player_1, player_2, dice_rolls)
action = Non... |
a09354f0610f5c8f5384c273a50613e4886e8d6e | 9e4638240bff8845dadc20385e102a1e366c7aae | downtown12/mywaytogetajob | /leetcode/jump-game-ii.py | Python | py | 1,650 | no_license | '''
https://leetcode.com/problems/jump-game-ii/
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Your goal is to reach the last index in the minimum number of jumps.
For example:
G... |
8e7a2a3cd4fd9d99e82316544b4f699f1b5260f4 | cda221b826ceef47686f2115eeb9d751d3c60835 | zt19994/pyQT5Demo | /pyqt5demo/pyqt5Icon.py | Python | py | 800 | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2021/6/19 21:20
# @Author : zt
import sys
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QWidget
# 设置icon
class Example(QWidget):
def __init__(self):
super().__init__()
# 界面绘制交给InitUI方法
self.init_ui()
... |
1e56423ceb8e6a6c00d0402eac229d4b192e477f | 1ba647670dd9a9547bc071933fbf92019d5bd394 | strongit/pytin | /cmdb/events/test_events.py | Python | py | 4,810 | permissive | from __future__ import unicode_literals
from django.test import TestCase
from events.models import HistoryEvent
from ipman.models import IPAddress
from resources.models import Resource
class HistoryEventTest(TestCase):
def setUp(self):
super(HistoryEventTest, self).setUp()
HistoryEvent.objects.f... |
b0ebb26bd30bcbb2ef5cfc5fd25403ffd87dc0f5 | d7a9ae80c7ec8dce0506852a12cb2b7c2965ea1d | riven314/pytorch-retinanet | /retinanet/losses.py | Python | py | 5,480 | permissive | import numpy as np
import torch
import torch.nn as nn
def calc_iou(a, b):
area = (b[:, 2] - b[:, 0]) * (b[:, 3] - b[:, 1])
iw = torch.min(torch.unsqueeze(a[:, 2], dim=1), b[:, 2]) - torch.max(torch.unsqueeze(a[:, 0], 1), b[:, 0])
ih = torch.min(torch.unsqueeze(a[:, 3], dim=1), b[:, 3]) - torch.max... |
61a349de7fff679734d02a2c0b443af58077eb68 | a1e3e56a8be5ac7cbc5d11b07b2d39d9fd431aef | wise-east/soloist | /soloist/soloist_train.py | Python | py | 38,450 | permissive | from __future__ import absolute_import, division, print_function
import argparse
import glob
import logging
import os
import pickle
import random
import re
import shutil
import time
import json
import sys
# use local version of transformers for training.
sys.path.append('.')
sys.path.append('./transformers_local')
s... |
a47615bc9018809e6f6efc289b7def3603c45b5b | e7cdb4aaf6ce1dc94a86edc6a2d6ff77ea9700b6 | Code-Institute-Submissions/noblesaleka-cassandra | /products/urls.py | Python | py | 477 | no_license | from django.urls import path
from . import views
urlpatterns = [
path('', views.all_products, name='products'),
path('<int:product_id>/', views.product_detail, name='product_detail'),
path('categories/', views.all_categories, name='categories'),
path('add/', views.add_product, name='add_product'),
... |
1d0432f4fe8c5a98e65e3227b6b8c20c1fda3c6c | be70fcd815594f9b30d81b509789b8340a52c537 | zhangyafeii/jwt | /jwt-django/utils/response.py | Python | py | 282 | no_license | # -*- coding: utf-8 -*-
"""
Datetime: 2020/04/15
Author: Zhang Yafei
Description:
"""
class BaseResponse(object):
def __init__(self):
self.status = 200
self.msg = None
self.data = None
@property
def dict(self):
return self.__dict__
|
575c14c653320202c40b4242ec808e40e0cdd340 | 883b15c407f54922cf42487539b0433c5942ed1f | yangjiaxuan/Python_Study | /MultiProcess/MutiProcessWorker.py | Python | py | 1,238 | no_license | #!/usr/bin/Python3
#encoding="utf-8"
print("======================= 分布式多进程 =======================")
print("|------------------------ worker ------------------------|")
import time, sys, queue
from multiprocessing.managers import BaseManager
# 创建类似的 MyManager
class MyManager(BaseManager):
pass
# 由于MyManager只从网上... |
fa67c58d3cbdfc647635952aad88088dc31dfb9e | 1a8944c4c075293a8b392433ca2db7b71c92671e | F5Networks/f5-adcaas-openstack | /app/portal/horizon/horizon/test/test_dashboards/cats/kittens/urls.py | Python | py | 747 | permissive | # 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, software
# d... |
2ac44bd2f2c9731c10dbc672a7edbbc8e1f4deae | b53e1310b836cefb47da6f68a8bba4e51746378d | lgpreston75/collie_recs | /collie_recs/loss/bpr.py | Python | py | 6,907 | permissive | from typing import Any, Dict, Optional
import torch
from collie_recs.loss.metadata_utils import ideal_difference_from_metadata
def bpr_loss(
positive_scores: torch.tensor,
negative_scores: torch.tensor,
num_items: Optional[Any] = None,
positive_items: Optional[torch.tensor] = None,
negative_item... |
97804594d44c299fba7ca390247ae47772031048 | 3a9d035555e056c6ee1f6becf3995bdd57941de6 | cash2one/eb_bigdata | /category/category.py | Python | py | 1,155 | no_license | # -*- coding:utf8 -*-
class Category(object):
"""
电商类目
"""
def __init__(self, category_id, parent_category_id, root_id, category_name):
"""
init 方法
:param category_id:类目本身id
:param parent_category_id:类目上一层类目的id
:param root_id:跟类目id
:param category_name:类... |
83fd85631496bc7caf3b8a3bc8e217ed7fe8d69e | 4d62ad83c21e76140bfa7cb3776d118315b72f8c | jing-zhen/telerl2021 | /phy_results/plotting_relevant_metrics_letter.py | Python | py | 8,111 | no_license | # #!/usr/bin/env python3
# # file: phy_env_class.py
#
# GENERAL DEFINITIONS
import os
import argparse
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import rc
from collections import OrderedDict
from phy.phy_env_class import param_under_test
def command_line_parse():
"""
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.