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 |
|---|---|---|---|---|---|---|---|---|
b95221bb445c80a102cdc392a21b69f7616f3624 | d38b2e7a0fa75ba5ed60a884262c184cf2915953 | anilsaini10/django-bookmarks | /bookmarks/account/forms.py | Python | py | 1,060 | permissive | from django import forms
from django.contrib.auth.models import User
from .models import Profile
class LoginForm(forms.Form):
username = forms.CharField()
password = forms.CharField(widget=forms.PasswordInput)
class UserRegistrationForm(forms.ModelForm):
password = forms.CharField(label='Pass... |
446ccd91622f93fbdd5a637d9e0093714823fcd8 | 64daaaecaa656269f7d01105ee93806087654628 | Chen-yu-Zheng/Mathematical-Model | /蒙特卡洛搜索树(MCTS)/Gomoku/sprites.py | Python | py | 1,288 | no_license | import pygame
from settings import *
class Player(pygame.sprite.Sprite):
def __init__(self, game, x, y, mov):
self.groups = game.all_sprites
pygame.sprite.Sprite.__init__(self, self.groups)
self.game = game
self.image = pygame.Surface((TILESIZE / 2, TILESIZE / 2))
self.image.fill(YELLOW)
self.rect = self.... |
d566b2c7b70f39c01d5093d0432d4a43306e4a5e | 29cf09352ce01e45c3bc72640e61df60922cdfe1 | albertovalverde/cognitive-computing | /Cognitive-NAO/Aldebaran/scripts-832a710168d03240adfbc00ffb87ba9fe737b3f5-832a710168d03240adfbc00ffb87ba9fe737b3f5/aldebaran-code/abcdk/config.py | Python | py | 1,730 | no_license | # -*- coding: utf-8 -*-
###########################################################
# Aldebaran Behavior Complementary Development Kit
# Config file
# Aldebaran Robotics (c) 2010 All Rights Reserved - This file is confidential.
###########################################################
"""Configure you preferences""... |
31c571d3d78a8ee8ab8c2163a98b5f3a91179a98 | 31ef724dfce585d3cb012c224a921f597ffe4ec6 | subhransusekhar/cloud-core | /tasks/app/dependencies.py | Python | py | 3,331 | permissive | # encoding: utf-8
"""
Application dependencies related tasks for Invoke.
"""
import logging
import os
import shutil
import zipfile
try:
from invoke import ctask as task
except ImportError: # Invoke 0.13 renamed ctask to task
from invoke import task
from tasks.utils import download_file
log = logging.getLog... |
26778cda1178c406b75c93ab985cf396c7f32982 | 8b05c3fab2303874f0922f736ba3a5b7b395be12 | ii0/minipay_demo | /paydemo/wsgi.py | Python | py | 391 | no_license | """
WSGI config for paydemo project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTI... |
771e723050495dd2c30dcd11f7a0b38cd49c8878 | 7c6bf898518ec24afd0216f85e965bdbab820c63 | andrebhu/cs1134 | /midterm2/q4.py | Python | py | 409 | no_license | #Runtime: n log n
def sum_exists(ls, val):
ls = sorted(ls)
a, b = 0, len(ls) - 1
while a < b:
if ls[a] + ls[b] == val:
return True
else:
if ls[a] + ls[b] < val:
a += 1
else:
b -= 1
return False
'''
print(sum_exists([8, 4, 6, 1], 10))
print(sum_exists([1, 2, 3, 4, 5], 90))
prin... |
4d4c1f2a952d69cc549340aa2ede43508cf06bcd | 969fd91bb4312f4543410ed7ac4b33159d719e8a | AZN3/PAZOS-DevOps | /webApp/urls.py | Python | py | 459 | no_license | from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('random/', views.randomString, name='randomString'),
path('hasher/', views.hasher, name='hasher'),
path('hasher/your_hash', views.your_hash, name='your_hash'),
path('details/',views.details,... |
08a8a3094f7f173bb15883ed96d713464176e3e7 | c7af8f973ce07de2bf8df893b1721287858177ca | melkamar/betscraper | /persistence.py | Python | py | 3,347 | no_license | import json
import time
import os
import logging
MODULE_PATH = os.path.dirname(__file__)
MATCH_REPORTS_FN = os.path.join(MODULE_PATH, 'persistent/match_reports.json')
def json_encode_status(match_report_status):
return {
'sent_56_mark': match_report_status.sent_56_mark,
'sent_60_mark': match_repo... |
827b6a130e683b08dea24654887de9341e65b760 | 9a3dd7f9f984de0ec183ed7392ab7b093c524f8e | nruedy/music-megahits | /code/RunModel.py | Python | py | 5,722 | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import roc_auc_score
... |
542ab7aaf3985315248e0bfc66d8c318c36a2d25 | b8f6a281f54db5091519697bd040c1d50ac769bd | mcormc/udacity-ipnd | /python/locate_first.py | Python | py | 297 | no_license | def locate_first(string, sub):
index = 0
while index < len(string):
if string[index : index + len(sub)] == sub:
return index
else:
index += 1
return -1
# This one should return 9
# print(locate_first('all your bass are belong to us', 'bass'))
|
8ee9b88143a21bfe106f13704641fe747b3320c4 | 43d35446dbc1bbd25d2a7145b2f7f2f929a9bb24 | z476698546/automatic_FAQ_system | /mysql_executer.py | Python | py | 808 | no_license | # encoding=utf-8
try:
import mysql.connector
except e:
print ('Error: %s') %e
class MySQL_Executer(object):
'''
MySQL wrapper
'''
def __init__(self, user, password, database):
try:
self.__connect = mysql.connector.connect(user=user, password=password, database=database)
self.__cursor = self.__connect.cu... |
e40ed12ee468ce9a44ef945a262ee44fe6b9ef4c | 6d21ea007d50bf4865d78911550fae4f71e4a02a | ricarvy/Portfolio_Management | /tools/config_loader.py | Python | py | 3,081 | no_license | # -*- coding: utf-8 -*-
# @Time : 2018/3/26 20:28
# @Author : Li Jiawei
# @FileName: config_loader.py
# @Software: PyCharm
import os
import json
rootPath=os.path.dirname(os.path.abspath(__file__)).replace('\\tools','\\net_config.json')
class ConfigLoader:
def __init__(self):
self.__config_path=rootPa... |
29e231df085dc6cfee0ba397083e08b712f2b9b6 | a66b7d54547548d2ffc20ed58e4130623a606d38 | GuilhermeMenescal/projects | /MatildaJournal/MatildaJournal/settings.py | Python | py | 3,287 | no_license | """
Django settings for MatildaJournal project.
Generated by 'django-admin startproject' using Django 3.2.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from ... |
255dc90ef84ac7824a816478722d57a111e57c62 | 42daf2e49c4515636e9d3502b91ffa54f91a74f2 | mjka/vcnl4040 | /examples/vcnl4040_simpletest.py | Python | py | 229 | permissive | from machine import Pin, I2C
import vcnl4040
i2c = I2C(scl=Pin(21), sda=Pin(22))
sensor = vcnl4040.VCNL4040(i2c)
while True:
print("Proximity:", sensor.proximity)
print("Light: %d lux" % sensor.lux)
time.sleep(1.0)
|
610d15c9d3be46fd83e4be0a0f8d8967645442e0 | 943fbceb5684dbaefdb7326a596549f3d33c892a | vrtiruko/GameAnalysis | /test_games/TestGameAnalysis.py | Python | py | 16,095 | no_license | #!/usr/local/bin/python2.7
import unittest
from os.path import dirname, join
from sys import path
import numpy as np
path.append(dirname(path[0]))
import GameIO as IO
import Dominance as D
import Nash as N
import Subgames as S
import Regret as R
import RoleSymmetricGame as RSG
class TestProfileDetection(unittest... |
ab90279f03930ad84a92f4d10b0cbfc498e0a6fd | 58932fde8d9c9ef13ed992b2b59f4212028ea6c7 | msarfati/pythonds-ms | /pythonds_ms/3_basic_ds/stack2.py | Python | py | 3,632 | no_license | #!/usr/bin/env python
class Stack:
def __init__(self):
self.items = []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def size(self):
return len(self.items)
def isEmpty(self):
return len(self.items) == 0
def pe... |
732010db54415bf756cf7e83ebd056e8be869898 | 2ec10a207a321da42f96efc8492362a1bd451d46 | UCLA-SEAL/QDiff | /data/p4VQE/R4/benchmark/startQiskit_noisy67.py | Python | py | 2,279 | permissive | # qubit number=3
# total number=8
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collection... |
19503de55973a5f3cc85b04d5addd7769170e610 | 08ee3798e8d667604153df815b608cac568ca10f | dpgaspar/Flask-AppBuilder | /examples/basefilter/testdata.py | Python | py | 2,423 | permissive | from datetime import datetime
import logging
import random
from app import appbuilder, db
from app.models import Contact, ContactGroup, Gender
log = logging.getLogger(__name__)
def get_random_name(names_list, size=1):
name_lst = [
names_list[random.randrange(0, len(names_list))].decode("utf-8").capitali... |
7512093e4a6b7c6d3a2b08801235c26d2e1c82dc | 870c63b622e9310defb6ea732a4b290ce89d754c | barnaghosh/My_Ecom_Project | /App_Shop/migrations/0003_auto_20210830_1904.py | Python | py | 578 | no_license | # Generated by Django 3.2.5 on 2021-08-30 13:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('App_Shop', '0002_category_seller'),
]
operations = [
migrations.AddField(
model_name='product',
name='cupon_number',... |
9a6293a2e50226a605a526fcee421c3f72385b4e | ef5b4d17aa84edc0b496f7e0a43a3862136030ce | MikeOcc/MyProjectEulerFiles | /Euler_6_293.py | Python | py | 1,478 | no_license | #
#
# Euler 293
#
#
from euler import miller_rabin
from time import time
st=time()
#p = [2,3,5,7,11,13,17,19,23]
d={}
for i in xrange(1,30): #2
for j in xrange(0,19):
#if i==0 and j>0:break
for k in xrange(0,12):
if j==0 and k>0:break
for m in xrange(0,9): #7
if (k==0 or j==0) an... |
78de21ef52bacdae837cf36c9f84715cd6de1276 | 862f24ca298a5d3d729d05a1c9cd93f2667f7d8b | acostaw/erp_odoo | /intn_constancias/__manifest__.py | Python | py | 1,106 | no_license | # -*- coding: utf-8 -*-
{
'name': "Constancias INTN",
'summary': """
Modulo que agrega la generacion de constancias""",
'description': """
Modulo que agrega la generacion de constancias
""",
'author': "Interfaces S.A.",
'website': "http://www.interfaces.com.py",
# Catego... |
8a17342225a16257e7f747d8198d29d5e75f313c | a0b6c87e20c63ea8a57bdd4ab99ae09a88239d2c | rmg515/sketchpad | /MarchMadness/features.py | Python | py | 5,334 | no_license | #Declare variables
ids = []
names = []
seeds = []
#Load in school names from Teams.csv
temp_ids = []
temp_names = []
namefile = open("Teams.csv")
for line in namefile:
line = line[:-1].split(',')
temp_id = line[0]
temp_name = line[1]
temp_ids.append(temp_id)
temp_names.append(temp_name)
#Load in seeds ... |
58f771916580a9502c7000f7fa97e0c67030a0af | 3c82a326b9ce12b4e02acf4303cf8b2ddf20045e | x4nth055/pythoncode-tutorials | /gui-programming/checkers-game/Piece.py | Python | py | 1,440 | permissive | import pygame
class Piece:
def __init__(self, x, y, color, board):
self.x = x
self.y = y
self.pos = (x, y)
self.board = board
self.color = color
def _move(self, tile):
for i in self.board.tile_list:
i.highlight = False
if tile in self.valid_moves() and not self.board.is_jump:
prev_tile = self.b... |
f6ba3ee165f974b64853d09169753fd54e25719a | a795e7417fa4a581306c92292389a933e6abecc8 | AeneasHe/eth-brownie-enhance | /brownie/_cli/gui.py | Python | py | 1,332 | permissive | #!/usr/bin/python3
from brownie import project
from brownie._gui import Gui
from brownie.utils.docopt import docopt
__doc__ = """Usage: brownie gui
Options:
--help -h Display this message
Opens the brownie GUI. Basic functionality is as follows:
* Selecting an opcode will highlight the associat... |
176e1f84b1a0a3b12627ca7de201cd3e8941c4df | c5b7abdaec1cf860e7b2573db14ba3e2f6df49e6 | dengzq1234/dj_gmgc | /gmgc/src/mongodb/gmgc_queries_2.py | Python | py | 7,895 | no_license | #!/usr/bin/python
## CPCantalapiedra 2019
import sys
import json
import gmgc_mongodb
from Clusters import Clusters
from Unigenes import Unigenes
from Sprots import Sprots
from Meta import Meta
### globals
VALID_FT = set(["ACT_SITE"]) #VALID_FT = set(["CHAIN", "ACT_SITE"])
DB_GMGC = "gmgc"
COL_CLUSTERS = "clusters... |
d46ed0240f73c2eb1297ed5b1ebf7f4e562d7578 | 4b404b278d412390110d9e69a1a2843068fde5ef | Chief0-0/Localizacion_ERP_V12 | /l10n_ve_isrl/models/account_tax_inherit.py | Python | py | 620 | permissive | # -*- coding: utf-8 -*-
# Copyright 2019 Yan Chirino <ychirino@intechmultiservicios.com>
from odoo import fields, models
class AccountTaxInherit(models.Model):
_inherit = "account.tax"
person_type = fields.Selection(
selection=(
[
("PNR", "Resident Natural Person"),
... |
d0f5cddcbe2c044b74d58e27a1fbddb47c559039 | 1d1b79dd33ea07a989189dd8dfa6d996cfe64215 | Yursksf1/profile | /myapp/migrations/0002_auto_20170811_1940.py | Python | py | 1,255 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-11 19:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myapp', '0001_initial'),
]
operations = [
migrations.AlterField(
... |
4a2c226b10c9eebd184104ea73dfa643f8a6e2ae | aa6eece8b6c9d10e70bb6b3c1e90ed4e8b887d28 | bbrock171/text-to-speech-python | /twitter_api_sanitized.py | Python | py | 3,215 | permissive | from twitter import *
import random, time, itertools, sqlite3, datetime, urllib
import numpy as np
import ujson as json
QUERY_INTERVAL = 0.009 # DD
RADIUS = '1mi' # No rhyme or reason to this radius. The API was returning bad results in meters.
MINX = -77.0956
MAXX = -77.0347
MINY = 38.7874
MAXY = 38.8689
TABLE = '... |
5c4980c5607e4eddc6015242e69f9b2a692e7187 | 3970cd2b78fb13057a2c84e3f564d0843eed7ae7 | JulianMW/python-resources | /search-algorithms/binary_search_range_3.py | Python | py | 868 | no_license | class Solution:
# @param A, a list of integers
# @param target, an integer to be searched
# @return a list of length 2, [index1, index2]
def searchRange(self, A, target):
solution =[-1,-1];
start = 0
end = len(A)-1
while start<end:
midpoint = (start + end )//2... |
61b82f84d9217f50573b82ba518aff7bdeebd60e | 5fead10b01cc3f8d76a361d0dc91a6ec41b72524 | jsialar/integrated_IAP_SDK | /ICA_SDK/ICA_SDK/models/generate_sample_sheet_for_sequencing_run_request.py | Python | py | 5,317 | no_license | # coding: utf-8
"""
IAP Services
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from ... |
a4e4ef3e70905c8210be4a48c1abc94141d982cf | b2b51e53a4c8334acd7193ca1aa35091fc681b42 | quintagroup/plone.app.layout | /plone/app/layout/globals/portal.py | Python | py | 3,274 | no_license | from zope.interface import implements
from zope.component import getUtility
from plone.registry.interfaces import IRegistry
from Products.CMFPlone.interfaces import ISiteSchema
from plone.memoize.view import memoize_contextless
from plone.memoize.view import memoize
from Acquisition import aq_inner
from Products.CMFCo... |
5e3e5bcb4cea20f75ebfac3a6093198dc3832630 | 6d66d93d9d704f1d9c20061f8ac0cb19e6efd060 | qiyuangong/ppdpes_core | /utils/read_adult_data.py | Python | py | 4,644 | permissive | #!/usr/bin/env python
# coding=utf-8
# Read data and read tree fuctions for INFORMS data
# attributes ['age', 'workcalss', 'final_weight', 'education', 'education_num',
# 'marital_status', 'occupation', 'relationship', 'race', 'sex', 'capital_gain',
# 'capital_loss', 'hours_per_week', 'native_country', 'class']
# QID ... |
78d773ad4366064c9589dce63f9fbba1bf78be0f | bf04340649bbe47c158680daddcde05a4a9356f2 | yaegasikk/-realworldanomaly | /Train.py | Python | py | 2,892 | no_license | from feature_dataloader import *
from network import *
import torch
import numpy as np
from tqdm import tqdm
import pandas as pd
batch_size=60
bag_size = batch_size//2
epochs = 20000
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
#device = "cpu"
print("Use {}".format(device))
torch.backends.c... |
7ec944ba291da34d69ce7009f99591b85d9070e1 | 3dbd58c1fcf5a4fe9bebe8da266beeca630c11d5 | Will3577/brpnet | /tafe/metrics.py | Python | py | 16,721 | no_license | import warnings
import numpy as np
from scipy.optimize import linear_sum_assignment
import cv2
import matplotlib.pyplot as plt
# The 'metrics.py' file is borrowed from the project of 'HoVer-Net', in which the name of this file is 'state_utils.py'
#####--------------------------Optimized for Speed
def get_fast_aji(tr... |
e170bed696c80206eab31c1a057247f61dca8eed | e9e06c26d701a039c0f0e39b37f2e900350bee03 | 1794/1794 | /Process/process_strings.py | Python | py | 758 | no_license | import string
from header_common import *
from module_info import *
from module_strings import *
from process_common import *
def save_strings(strings):
ofile = open(export_dir + "strings.txt","w")
ofile.write("stringsfile version 1\n")
ofile.write("%d\n"%len(strings))
for i_string in xrange(len(strings)):
... |
fa6cbbcfe19f0f41d06251001cd438a5bb7e2901 | 05bd4c34019f9a58d348a7471b0340e8d6ca6c57 | delph-in/pydelphin | /tests/semi_test.py | Python | py | 13,638 | permissive |
import pytest
from delphin import semi
def test_properties(tmp_path):
p = tmp_path / 'a.smi'
p.write_text(
'properties:\n'
' bool.\n'
' + < bool.\n'
' - < bool.\n')
s = semi.load(str(p))
assert len(s.properties) == 3
assert all([x in s.propertie... |
6a0899517d2af9f6a5abedce7f37c4b2a41ba58b | fc3388427b4d5486d52aedef8bc7499ebf67e2e0 | wuchen-huawei/huaweicloud-sdk-python-v3 | /huaweicloud-sdk-bss/huaweicloudsdkbss/v2/model/cancel_customer_order_req.py | Python | py | 2,942 | permissive | # coding: utf-8
import pprint
import re
import six
class CancelCustomerOrderReq:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the v... |
58b106e307fd9599f6f67a6ddec26fb3e0f5842a | 27dc44e0f1cad2e7de5169807d0daedfb4263f12 | zhuth/dhqnet | /bbs/migrations/0003_auto_20160629_0145.py | Python | py | 627 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-06-29 01:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bbs', '0002_post_link'),
]
operations = [
m... |
75b92723cb78870be448c2f671e3bb29d512f0ff | f4386e9b3d5ab08b37a2cf4c103e252063dbea59 | Jaamunozr/Archivos-python | /Archivos Python Documentos/Graficas/.history/tierras_20200220183541.py | Python | py | 1,629 | no_license | import os
import pylab as pl
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
os.system("clear")
fig = pl.figure()
axx = Axes3D(fig)
raiz=np.sqrt
ln=np.log
X = np.arange(-2, 12, 0.1)
Y = np.arange(-2, 12, 0.1)
#Z = np.arange(600,10000,1000)
"""
X[25]=0.49
X[65]=4.49
X[105]=8.49
Y[25]=0.49
Y[65]=4.49
Y[105]... |
a5b5909c1043025b8a173a39c5f1e5d212df3b83 | 589be6b27966264aa79849fcefb99fd883d315bc | MahmoudAyman/OSS | /OSS/wsgi.py | Python | py | 384 | no_license | """
WSGI config for OSS project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS... |
5b624b6ce3ca7ba7e60387e00b8351c48e939719 | c394e86ac16145202f114123259f1f715fdd6709 | shavkunov/MLSE | /codebert/codebert.py | Python | py | 11,348 | no_license | #!/usr/bin/env python
# coding: utf-8
import pandas as pd
from transformers import pipeline
import math
import numpy as np
import torch
import os
from tqdm import tqdm
from transformers import AutoTokenizer, AutoModel
def columns_to_list(df, columns):
return list(zip(*[df[c].to_list() for c in columns]))
de... |
3afd496bda8b3b6494232b6b733d581fa6f99f48 | 4746f729813abf044cad64b9de94d140ee3c4abc | bryanbernigen/ITBSem2 | /Python/praktikum1/segiempat.py | Python | py | 591 | no_license | #Nama : Bryan Bernigen
#NIM : 16520237
#Tanggal :
#Judul
# Spesifikasi
#Kamus (Deklarasi tipe, variabel, konstanta, fungsi, prosedur)
'''
'''
#Algoritma
n=int(input())
char1=input()
char2=input()
i=0
j=0
if n<=0:
print("Masukan tidak valid")
elif char1==char2:
print("Masukan tidak valid"... |
4cd3a9aadde830e71f88066e6cee5b1612c65116 | ca725bd5d8df97ac4784b075f47781c89e460043 | lion7500000/NEW_AMAZON_PROJECT | /features/steps/Amazon_popup.py | Python | py | 589 | no_license | from behave import given,then,when
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
Sign_In_btn = (By.CSS_SELECTOR,"#nav-signin-tooltip >a")
@then ("Sign_In popup is present and clickable")
def Sign_In_present_clickable(context):
context.driver.wait.un... |
1df39ffba8fb546d47148733d4f3f6790f7ef57d | 272dadde263c80052f1c6125632b489b592ea6c0 | minesweeper228/minesweeper1 | /src/player.py | Python | py | 336 | no_license | from result import Result
class Player:
def __init__(self, login, password):
self.login = login
self.password = password
self.last_results = []
def add_result(self, difficulty, is_win):
self.last_results.insert(0, Result(difficulty, is_win))
self.last_results = self.la... |
e9801eb3162990bec35c76f22735fe8ddbb3866f | f3623999683b393347173e121516f51da2f57794 | serkanshnn/pixel-it | /levels/levelfour.py | Python | py | 1,734 | no_license | levelCorrection = []
levelCorrection.append(1)
levelCorrection.append(1)
levelCorrection.append(1)
levelCorrection.append(1)
levelCorrection.append(1)
levelCorrection.append(1)
levelCorrection.append(1)
levelCorrection.append(1)
levelCorrection.append(1)
levelCorrection.append(1)
levelCorrection.append(0)
levelCorrect... |
eb2fa7a574a06eff59e338d5e08ef0800257d2f4 | 12278db3997db7a8ebca804b75979090f968ca8d | Lance-Drane/scraper | /scraper/code_gov/models.py | Python | py | 24,957 | permissive | #! /usr/bin/env python
# -*- coding: UTF-8 -*-
import json
import logging
from dateutil.parser import parse as date_parse
from requests.utils import requote_uri
import github3
import gitlab
from scraper.github.util import _license_obj
from scraper.util import _prune_dict_null_str, labor_hours_from_url
logger = logg... |
3d03cdf10816065e2cd33bed1a9a4fead409805e | a158fbaa6c88f4bb54fe387d7938cfe35b3b532f | diogoxiang/Diobbs | /url.py | Python | py | 260 | permissive | #!/usr/bin/env python
# coding=utf-8
"""
the url structure of website
"""
import sys #utf-8,兼容汉字
# reload(sys)
# sys.setdefaultencoding("utf-8")
from handlers.index import IndexHandler #假设已经有了
url = [
(r'/', IndexHandler),
] |
980d3bbdc14cc0dd9f2f6b71848b927a2fe02caa | cb669e00460a141cd68ef2bb44d1afa34b699f34 | lv0817/TKinter | /tk12.py | Python | py | 525 | no_license | '''
滚动条
'''
import tkinter as tk
root = tk.Tk()
sb = tk.Scrollbar(root)
sb.pack(side = 'right',fill=tk.Y)
lb = tk.Listbox(root,yscrollcommand=sb.set)
for i in range(100):
lb.insert(tk.END,i)
lb.pack(side='left',fill=tk.BOTH)
sb.config(command=lb.yview)
#yview是内部设置y方向如何显示,不用我们关心他是如何实现的
#注意要在其他lb创建好再去配置某个选项,不然... |
fba87df712150f6d5599723ed5f8f25fb536d3e1 | df863ca67500b505f8696eebbffe366e479b47bc | jarac18/PyAttck | /attackmalware.py | Python | py | 967 | no_license | #!/Users/toddjones/DevLeague/pyattck/venv/bin/python3import argparse
import argparse
from pyattck import Attck
attack = Attck()
def get_actor(act):
for actor in attack.actors:
if act == actor.name:
print('This is the Actor Name:', actor.name)
print('This is the Actor Techniques used:')... |
a13c361e11d35f6adbd2f4070ee95b63f3e79e31 | 6e8838c7841429d0c1d95df51700c56ae27ccc04 | cloudsurf-digital/sauron | /sauron/__init__.py | Python | py | 9,162 | permissive | #! /usr/bin/env python
#
# Copyright (c) 2011 SEOmoz
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, m... |
4bbc520f870eef774ee5cf26a1f7a504e4da4272 | c1e126963f4b8efa4ac6f46c436eadda04b4ea21 | FusterTormo/ALFRE2 | /pvalue_combine.py | Python | py | 3,666 | no_license | #import re,sys,os, glob
#from string import *
#import math
import numpy
#import random
#from numpy import array
import scipy
#from scipy import stats
#import csv
#import pvalue_combine
#from sets import Set
#import math
#from scipy.stats import *
def combine_pvalues(pvalues, method='fisher', weights=None):
"""
... |
c29c1d80d840b8477d2e01d682cee318bfc02815 | d6fb086a97e3a220e20bab2666d1630b6efe01ba | astoliarov/toshokan | /src/run.py | Python | py | 279 | permissive | # coding: utf-8
import datetime
from infrastructure.application import Toshokan
from infrastructure.db.mock.daos import MockLinksDAO
from infrastructure.external.pocket.service import PocketLinkSource
if __name__ == "__main__":
toshokan = Toshokan()
toshokan.run_cli()
|
d4c575c405594cdd57b53ccd0ecbbbea91f81a5e | 90a2930fc337005d095407d7ca392f8efebab3dc | zeroc0d3/integrations-core | /iis/tests/test_iis.py | Python | py | 6,726 | permissive | # (C) Datadog, Inc. 2010-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import copy
import logging
import re
import pytest
from datadog_test_libs.win.pdh_mocks import pdh_mocks_fixture # noqa: F401
from datadog_checks.iis import IIS
from .common import (
APP_POOL_METRICS,
... |
41ecb0bedb539029761d877862d362e53d688c14 | 1c0240391cc72dff617605bd6f0beeee226814ae | EvangelieAnagnostopoulou/PBPK | /pbpk/migrations/0008_auto_20141107_0714.py | Python | py | 4,885 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pbpk', '0007_auto_20141101_1529'),
]
operations = [
migrations.CreateModel(
name='Drug',
fields=[
... |
c682a6cbcded574a54c11b224e7e4268d58bbd9c | e04d05bfddad6fe57213055c8db180502080bcd3 | hreeder/botbot | /ircbot/plugins/rss.py | Python | py | 4,005 | no_license | import feedparser
import logging
import time
from ircbot import bot, Format
logger = logging.getLogger("BotBot-RSS")
@bot.periodic()
class RSSCallback:
def __init__(self):
# m s ms
self.callback_time = 15 * 60 * 1000
self.prefix = "{}[RSS]{}".format(Format.GREEN,... |
566c9ecfece55d9a31ca1ce2a272304057f1b42e | 68b215664705774d022d062fbd2260223785f729 | Sunset-Knight/LearnPython | /032_ThreadLocal.py | Python | py | 598 | no_license | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
import threading
# 创建全局ThreadLocal对象:
local_school = threading.local()
def process_student():
# 获取当前关联的student:
std = local_school.student
print('Hello, %s (in %s)' % (std, threading.current_thread().name))
def process_thread(name):
# 绑定ThreadLocal的student
local_... |
d83ae3899a91479d9cf442875c7e3e45ba6cf17b | 7c0d5cf6c0e78cc0cab68508a30cc3d43f90d7f1 | windyStreet/el-OAMP | /bin/utils/deal_database.py | Python | py | 4,917 | no_license | #!/usr/bin/env python
# !-*- coding:utf-8 -*-
from bin.base.tool import JsonFileFunc
from bin.base.data import FileUntil, Path
import json
import os
P = Path.getInstance()
F = FileUntil.getInstance()
J = JsonFileFunc.getInstance()
class deal_database(object):
def __init__(self):
pass
def read_datab... |
afcf1a2f92585132cfa940af1479abf1a743654c | 6b8f3ba5aeb37e9fa6422702da15c9a31f179a39 | mozilla-b2g/uplift | /tests/branch_logic_tests.py | Python | py | 3,293 | no_license | import unittest
import os
import gaia_uplift.branch_logic as subject
import gaia_uplift.configuration as c
import util as u
test_config = os.path.join(os.path.dirname(__file__), "branch_rules_tests_config.json")
class BranchLogicTests(unittest.TestCase):
def setUp(self):
self.old_json_file = c.json_file
... |
e0c6490c3f81004177fa45a79d12d9cbe991a175 | 20a36e08e7ad7a447d119f0ce8d5e1ca31489cd6 | shromonag/VerifAI | /setup.py | Python | py | 543 | permissive | from setuptools import setup, find_packages
setup(name='verifai',
install_requires=[
'numpy',
'scipy',
'pulp',
'dotmap',
'metric-temporal-logic',
'matplotlib',
'easydict',
'joblib',
'dill',
'pyglet',
'fu... |
728593bd6ba799ca78c9901673e5e0ffbaf8124d | e73ed4baded587f1529c50e60a1e365bf5185e18 | Murodbey/Terraform-project | /AWS/provision_awx_with_terraform/awx/awx/main/dispatch/worker/base.py | Python | py | 5,188 | permissive | # Copyright (c) 2018 Ansible by Red Hat
# All Rights Reserved.
import os
import logging
import signal
import sys
from uuid import UUID
from queue import Empty as QueueEmpty
from django import db
from kombu import Producer
from kombu.mixins import ConsumerMixin
from awx.main.dispatch.pool import WorkerPool
if 'run_c... |
a348439918fcc8786ed95dbcaf285c12663672db | 7c6fd52de6040c4136e154d5711b8544494ef841 | ShenQM/PhotoEdit | /UI/FileManage_ui.py | Python | py | 5,652 | no_license | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'UI/FileManage.ui',
# licensing of 'UI/FileManage.ui' applies.
#
# Created: Sun Nov 18 22:33:33 2018
# by: pyside2-uic running on PySide2 5.11.1a1.dev1542405709
#
# WARNING! All changes made in this file will be lost!
from PySide2 impo... |
68441bc2c0c02bfc6660c53f32ee82cd2ae2f982 | bf527c8d9a798ffa0702880ad80f4bc755042a66 | ashucompbio/HIV_RT_network | /create_network.py | Python | py | 7,675 | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu July 20 2017
This script contacts functions to calculate the dynamic network type contact networks from HIV RT structures
@author: ashutosh
"""
import os
import subprocess
import shutil
from distutils import spawn
from Bio import PDB
from Bio.PDB.PDBParser import PDBParser #... |
5e566caa5ad09d35b676d6f3aa5c2ef3f3166d95 | 427b471841b13bbc802387e1773d2c02dc6d8306 | PLC-Programmer/Python | /shell_sort.py | Python | py | 3,651 | no_license | # shell_sort.py
#
# 2016-03-20
#
# idea after: https://en.wikipedia.org/wiki/Shellsort
# number of comparisons: << n*n
#
#
# PEP8 check (http://pep8online.com): OK
# test on: Win8.1 (64 Bit), CLI Python 3.5.0: OK
# test on http://ideone.com: OK
# !!BEST!! with a "small" array with N = 100
# step distanc... |
dc2c61972e873c6a743e927cbf447e9dbb6dd9e8 | da255cd93a9435ef850f112ad40919b395f51224 | gelkomy/iNNOSP | /feature_extraction.py | Python | py | 2,643 | no_license | # -*- coding: utf-8 -*-
'''
% This file extracts features from input dataframe of a specific patient
% the output is a dictionary of dataframes with the extracted features
%
% /****************************************************************************
% * Job: Feature Extraction ... |
9dc32a2165003f9353ad1f6a950e7837194c3142 | 939c6b49e0b22b44990abbde6126303b9da1a799 | thecho7/SearchStock_Korea | /getMarketCap.py | Python | py | 4,465 | no_license | # CpSysDib.MarketEye 서비스를 이용하여 복수 종목의 상장 주식수와 현재가를 가져온 후
# 시가총액 = 상장주식수 * 현재가
# 식으로 계산했습니다
# 상장 주식 수 관련해서는 20억 이상 상장주식수를 가진 종목의 경우 천단위로 제공 하고 있어 아래 함수를 통해 확인하는 부분도 참고 바랍니다.
# CpUtil.CpCodeMgr 서비스 IsBigListingStock(code) : 상장 주식수 20억 이상 여부 리턴
import sys
import win32com.client
import ctypes
###########... |
f0d23de91c96bbb0e0d9a0a75469fd3c1e515f7d | 5695ab2eb5398d17b0839b476a7ea46cc8790c42 | kinjal-lalani16/backend_javascript | /javascript/__manifest__.py | Python | py | 824 | no_license | # -*- coding: utf-8 -*-
{
'name': "javascript",
'summary': """This module is contain javascript""",
'description': """TThis module is contain javascript""",
'author': "Aktiv software",
'website': "http://www.aktivesoftware.com",
'category': 'Tools',
'version': '13.0.1.0.0',
'depends': ['... |
cb2de9dc6232df5ef2514deb64958b8d09e1b898 | 34e563e30039d573219ae4d8ae244aecd2659caf | crowdbotics-apps/majoritybook-23869 | /backend/chat/api/v1/viewsets.py | Python | py | 1,983 | no_license | from rest_framework import authentication
from chat.models import (
Message,
ThreadMember,
MessageAction,
ThreadAction,
ForwardedMessage,
Thread,
)
from .serializers import (
MessageSerializer,
ThreadMemberSerializer,
MessageActionSerializer,
ThreadActionSerializer,
Forwarded... |
7b8e47f4a440176d534e89b2be675eb85ec373ae | 6d59af05ba8c26e6034f4edae0532aac4ad3b7ed | NikitaKorablev/Analysis-of-satellite-images | /landsat_to_reflectance.py | Python | py | 847 | no_license | import numpy as np
# import tifffile
def l_to_r (folder, folder2, save):
data = {}
with open(folder2) as file:
for line in file:
key, *value = line.split()
data[key] = value
sun = float(data['SUN_ELEVATION'][1])
for i in range(9):
if i... |
9384d87d8ed6d8f17119fed72e7b78454fc9685e | 7bc70e5ca965047505c3f33d38afadbda096f9ff | cruelflanky/django-shop | /orders/migrations/0009_auto_20200704_1249.py | Python | py | 1,332 | no_license | # Generated by Django 3.0.7 on 2020-07-04 12:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('orders', '0008_auto_20200703_2117'),
]
operations = [
migrations.AddField(
model_name='productinbasket',
name='sessi... |
47b886c936bb37048278a0a14cf224d3e18813d0 | cdc894c46d69013b7f9bc54f0b50d5d4193f1155 | chrisguiney/pyportscanner | /portscanner/socketutil.py | Python | py | 574 | permissive | import socket
def is_open(host, port):
s = socket.socket()
s.settimeout(1)
try:
s.connect((host, port))
return True
except Exception:
return False
finally:
s.close()
def scan(hostport):
host, port = hostport
return ScanResult(port, is_open(host, port))
c... |
9a379f8480e8c580e574eaa4cbaf933ef70e2bf4 | d64493bcd6f912a7184df069279e68855868a923 | shindesharad71/Data-Structures | /01.Array/rotation/count_rotations.py | Python | py | 673 | no_license | # Python3 program to find number
# of rotations in a sorted and
# rotated array.
# https://www.geeksforgeeks.org/find-rotation-count-rotated-sorted-array/
#
# Returns count of rotations for
# an array which is first sorted
# in ascending order, then rotated
def count_rotations(arr: list, n: int) -> int:
rotation = ... |
1b6c5c3abd78ac5a7f59a8e468679b8e08f3fd3d | 6ea2c88163a8a5a80c92734ca13eea7c0c1e4ed5 | Yasunny/Auto_Testcase | /modul/Test_lists/test_case/search.py | Python | py | 913 | no_license | #coding=utf-8
import unittest
#import HTMLTestRunner
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class TestCase1(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
def test_search_python_org(self):
driver = self.driver
driver.get("h... |
549fe411af1ac00ca5854b4ffd1c268a4f897012 | cf96eeaa5094ddde006d6b585cc6bc6786d80857 | ErikHorus1249/TK_Making_Python_game | /Class_HN_TP_C_PA_1116_SNPY_0098/Game_Demo/Pygame_pro/main.py | Python | py | 7,725 | no_license |
import pygame
import os
import time
import random
pygame.font.init()
WIDTH, HEIGHT = 850, 850
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Space shooter")
# Tai hinh anh game
RED_STAR_SHIP = pygame.image.load(os.path.join("hinh_anh","pixel_ship_red_small.png"))
GREEN_STAR_SHIP = pyga... |
030496b1dce9bd6cdea04e65dff0db4ad1b52414 | 63454e123fd4c7e3c97faa7d0fbcd92b3a256579 | srinivas-narayan/GuideCCI_35 | /itk2Monaco_Directory.py | Python | py | 6,288 | no_license | import os
import sys
import vtk
# import PyQt4.QtGui as QtGui #for Qt4 - not in python 3.5
import PyQt5.QtWidgets as QtGui
from vtk.util.colors import red, blue, white, black
# --------------------------------------------------- FILE SELECTION ---------------------------------------------------
app = QtGui.QApplicatio... |
af88ec1a577c9bd53f0e16ef92c0bd223cf65fea | c7111724852db8856365a6feb7ba5cc2ecf3769d | Goshaka/tikal-exercise | /app1/app1.py | Python | py | 270 | no_license | from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
html = "<h3>The system is up and running: {name}!</h3>" \
"<b>Docker App1</b> <br/>"
return 'Docker, App1!'
if __name__ == "__main__":
app.run(host='0.0.0.0', port=80)
|
a185908f98ff10b99c554a48a616602577bbfac1 | 4e9b04869c39583261eacb161763cc608d1fa5ff | yoseng28/credit_fraud | /model/model_XGB.py | Python | py | 4,988 | no_license | import time
from pandas import DataFrame
from sklearn.model_selection import StratifiedKFold, GridSearchCV
from xgboost import XGBClassifier
import xgboost as xgb
class ModelXGB:
@staticmethod
def xgb_predict_prob(X_train, y_train, X_test):
xgb_clf = XGBClassifier(
learning_rate=0.4,
... |
6f6f96788bb33286b202fd2465dca6d913f61a27 | 1d8806f8b771b0a9b1ded49fe35da58ab9585042 | natourfaris/convertPictures | /scripts/convert.py | Python | py | 1,093 | no_license | import os
from shutil import copyfile
import sys
from PIL import Image
username = sys.argv[1]
origPath = 'C:\\Users\\{}\\AppData\\Local\\Packages\
\\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\\LocalState\\Assets'\
.format(username)
filenames = os.listdir(origPath)
destination = os.getcwd()
for filename ... |
10dd366fdda548536984dbb1eb5f9d2661f03e11 | fffbfcf4d2a3aa0998b8bac17ab7de8ff10673a0 | pd0wm/panda | /tests/safety/test_tesla.py | Python | py | 6,041 | permissive | #!/usr/bin/env python3
import unittest
import numpy as np
from panda import Panda
import panda.tests.safety.common as common
from panda.tests.libpanda import libpanda_py
from panda.tests.safety.common import CANPackerPanda
MAX_ACCEL = 2.0
MIN_ACCEL = -3.5
class CONTROL_LEVER_STATE:
DN_1ST = 32
UP_1ST = 16
DN_2... |
3e1ce137d41946c3bc74978c68768bd30b532c78 | 248768d05aac9e4721ceedbd7109b5e8d15f111f | wyljpn/LeetCodeTest | /HashTable/1. Two Sum.py | Python | py | 443 | no_license | class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
# key: target - num
# value: index of (target - num)
record = dict()
for index, num in enumerate(nums):
if nu... |
75f08af963797c94283b05a2a051cbd7a6721b6b | 9c607c09720ed62a92ba385d628df194a835b7e0 | RafiKueng/HPC_HYDRO | /HYDRO_C/Output/Input_sedov_1000x100/plot_hardscaling_zoom.py | Python | py | 1,199 | no_license | """
This script produces a t vs N plot for the hard scaling.
"""
#import matplotlib as mpl; mpl.rcParams['font.family'] = 'serif'
from matplotlib import *
rcParams['font.family'] = 'serif'
from matplotlib.patches import *
from numpy import *
from matplotlib.pyplot import *
from sys import *
def ratio_s_v(np, nx, ny):
... |
31529b56063cd2080f3ad127e53166eba61887b5 | d392c3b498251a0bcb51b5ab471d53e6e37e59c7 | evrardgarcelon/Multi-armed-bandits-with-side-observations | /environnement/MAB.py | Python | py | 909 | no_license | import numpy.random as npr
import numpy as np
from environnement.Results import *
class MAB:
def __init__(self,arms,Delta):
self.arms = arms
self.nbArms = len(arms)
self.delta = Delta
def play(self,policy,epsilon,T):
policy.startGame()
result = Result(self.nbArms,sel... |
52c12cd49eeefe1b29ff1dfeed0f3699f48ce86f | f0b47f73ab6b17a81ef7022d54290d79162f6fd8 | cthoyt/authorship | /src/authorship/writers/base.py | Python | py | 1,359 | permissive | """Base writers."""
from __future__ import annotations
from abc import ABC, abstractmethod
from pathlib import Path
from typing import TYPE_CHECKING, Iterable, Union
from ..models import Authorship
if TYPE_CHECKING:
from ..readers import Reader
__all__ = [
"Writer",
]
class Writer(ABC):
"""A writer f... |
e4f8440bfec8eee6bcef0930648af83722bd6a81 | 4fbc6027809be6ccacb9bc1e82753cbd57ab3803 | OakenMan/TP_Python | /tp3_login.py | Python | py | 4,380 | no_license | import tkinter as tk
from tkinter.messagebox import showinfo
import hashlib
import os
#from Crypto.Random import get_random_bytes
from Crypto.Protocol.KDF import PBKDF2
from Crypto.Cipher import AES
master = tk.Tk()
labelLogin = tk.Label(master, text="Login :")
labelLogin.pack()
entryLogin = tk.Entry(master, width=... |
3572fc0a72d26c9f3f1928af7d287e3501371fb8 | a037bab26e1b7a582c42137ba04f812f0b84ad3e | KumarSwaraj/Turtle | /project2.py | Python | py | 394 | no_license | def square(side_length):
for i in range(4):
turtle.fd(side_length)
turtle.lt(90)
square (150)
turtle.penup()
####New Square###
turtle.left(90)
turtle.forward(75)
turtle.left(90)
turtle.forward(30)
turtle.right(180)
turtle.right(45)
turtle.pendown()
def square(side_length):
for i in r... |
ed0dd2e475daf065fdc62ed0f5b8df1190166374 | 8800615d3adade521d71d58a450efd9ab2ed0b98 | graphcore/examples | /nlp/gpt3_175B/popxl/tests/integration/layers/test_lm_TP2D.py | Python | py | 4,613 | permissive | # Copyright (c) 2023 Graphcore Ltd. All rights reserved.
import numpy as np
import torch
# HF
from transformers.models.gpt2 import GPT2Config as HFConfig
from transformers.models.gpt2.modeling_gpt2 import GPT2LMHeadModel as HFGPT2LMHeadModel
import popxl
from popxl.utils import to_numpy
import popxl_addons as addons... |
1183d6413c2b63bd384f4922a4a6bfb0b9d3c1d5 | ed27b5a72e1213064ebba201f18321d02ff944a6 | laythirshaud/python_stack | /django/django_intro/first_project/first_app/views.py | Python | py | 599 | no_license | from django.shortcuts import render, HttpResponse, redirect
def root(request):
return redirect('/blogs')
def index(request):
return HttpResponse("placeholder to later display a list of all blogs")
def new(request):
return HttpResponse("placeholder to display a new form to create a new blog")
def create(re... |
b15fec99adca0f7c5ba34e917c983a076b669b75 | 8ddd237e714dfae33bdf69a1ee83d03e5108c544 | kontramind/zivid-python | /samples/sample_capture.py | Python | py | 462 | permissive | """Capture sample."""
import datetime
import zivid
def _main():
app = zivid.Application()
camera = app.connect_camera()
with camera.update_settings() as updater:
updater.settings.iris = 40
updater.settings.exposure_time = datetime.timedelta(microseconds=40000)
updater.settings.fil... |
8f5303429ab54c8a975f65fb98029ce8ccfe5b83 | ea6883ae2e06757513a984dbd6ca4724e9b608ef | tk0miya/sphinxcontrib-markdown | /tests/test_markdown.py | Python | py | 22,231 | permissive | # -*- coding: utf-8 -*-
import sys
from docutils import nodes
from textwrap import dedent
from sphinx_testing import with_app
from sphinxcontrib.markdown import md2node
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
class TestSphinxcontrib(unittest.TestCase):
def test_s... |
c6eb182542352e5f5d9c476cc32de802e86f697e | 78abf50fccac8396d9db5d8f2b99e5ff6d409edb | lizhen-dlut/pyomo | /pyomo/core/base/symbolic.py | Python | py | 7,390 | permissive | # _________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2014 Sandia Corporation.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
# This softwa... |
3ba7f746fa3d948a2fd562c2c8d7e9c2bf6afb86 | 1e94af45d94254026bd42b0bd8d6a350a92629aa | FGFW/FCNNIC | /实现一行内容分行输出/python版一行内容分行输出.py | Python | py | 1,915 | no_license | # -*- coding=utf-8 -*-
#python版一行内容分行输出
#依山居 18:14 2015/11/4
#题目来源 http://www.bathome.net/thread-1454-1-1.html
a="aA1一bB2二cC3三dD4四eE5五fF6六gG7七hH8八iI9九"
"""
分行输出为:
abcdefghi
ABCDEFGHI
123456789
一二三四五六七八九
"""
print("方法一:===============")
for r in range(0,4):
t=''
for s in range(0+r,len(a),4):
t=t+a[s]
... |
d37330e3c9569eaf45e975f3ec3198f7d9865877 | 8203961bedb015677a54fa8a9a9528b02b105e5f | samuelcolvin/fastapi | /tests/test_security_openid_connect.py | Python | py | 2,172 | permissive | from fastapi import Depends, FastAPI, Security
from fastapi.security.open_id_connect_url import OpenIdConnect
from fastapi.testclient import TestClient
from pydantic import BaseModel
app = FastAPI()
oid = OpenIdConnect(openIdConnectUrl="/openid")
class User(BaseModel):
username: str
def get_current_user(oauth... |
fcfd250acad8cb3ac13f9456be5386e565c00df9 | 4ba1da4e4ef2468ec8fa0a78256078010ef6e69d | konvish/yolo | /dl/frozenLake.py | Python | py | 2,083 | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Created by kong on 2020/8/26
import numpy as np
import gym
import random
from gym.envs.registration import register
register(id="FrozenLakeNotSlippery-v0",
entry_point='gym.envs.toy_text:FrozenLakeEnv',
kwargs={'map_name': '4x4', 'is_slippery': False},... |
8cab4592cdf2c8a3b82a3804ffa0d04420e91a82 | fbc0e7fd800c9d1dd0159d90451836a095a3c3cb | DajuanM/DHPythonDemo | /02_高级用法/07_协程/v02.py | Python | py | 352 | permissive |
def simple_coroutine(a):
print('-> start')
b = yield a
print('-> recived', a, b)
c = yield a + b
print('-> recived', a, b, c)
d = yield a + b + c
print('-> recived', a, b, c, d)
# runc
sc = simple_coroutine(5)
print("=====")
aa = next(sc)
print(aa)
bb = sc.send(6) # 5, 6
print(bb)
cc = ... |
03b04d18a32eb2378a1fb8f116af3d117b81d4b0 | b54b86774710bba801ee8b231d677fa1bd2482ef | eugene-bulkin/kata-test-framework-python | /test.py | Python | py | 362 | no_license | from framework import *
z = 3
@Test.describe("Derp")
def describe():
@Test.it("herp")
def it():
x = 1
y = 3
Test.assertEquals(x, y)
Test.assertEquals(y, z)
@Test.it("blerp")
def it():
@Test.expectError()
def fn():
raise Exception('aasdf')
@Test.expectNoError()
def fn():
... |
2944f488ee903f810ccede3b73b3cf55c991d3f5 | 1c9d47fc4d626c2216e9d4558165e4805e38967f | marcinmiksa/djangoMovieShop | /movieShop/migrations/0004_auto_20190430_1244.py | Python | py | 443 | no_license | # Generated by Django 2.2 on 2019-04-30 10:44
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('movieShop', '0003_auto_20190430_1243'),
]
operations = [
migrations.RemoveField(
model_name='category',
name='created_at',
... |
ee99d633a28e2c42c827f34dd868fb5d626ca902 | 456f4755a4ab864af3d8bd538a15493f3a2a40ae | bill4278/IVUSReviewer | /main.py | Python | py | 8,752 | permissive | from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QIcon, QImage, QPixmap
import sys
import os
import numpy as np
import cv2
import pandas as pd
from pandas import DataFrame
import glob2
from Ui_main import *
class openNPY(QMainWindow, Ui_Mainwindow):
de... |
0f4988d16756efe1075b91845ab41ef0f9b6b29b | 6af163c5b7685da3010fc3fc4850f1030fd54b62 | bvedad/django-ckeditor-5 | /example/blog/blog/settings.py | Python | py | 5,927 | permissive | """
Django settings for blog project.
Generated by 'django-admin startproject' using Django 3.0.
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 os
# Buil... |
ba0f50a25379f3549dafd7be799db36ddd695cd2 | f1961bf1916d0e9f9d9a0d14383eca287c64cbc3 | LinGeorge/Face_Mask_Detection_Darknet | /darknet53_mask_MFN/image_merge.py | Python | py | 4,219 | no_license | import os
import PIL.Image as Image
def resize_by_width(infile, image_size):
"""按照宽度进行所需比例缩放"""
im = Image.open(infile)
(x, y) = im.size
lv = round(x / image_size, 2) + 0.01
x_s = int(x // lv)
y_s = int(y // lv)
print("x_s", x_s, y_s)
out = im.resize((x_s, y_s), Image.ANT... |
8d72fccdfec171ae5565972eb0279c89be350b82 | c67c7792887eac6412b57b3cdf3e787647556c84 | alexb31/python-project | /bouncer.py | Python | py | 597 | no_license | # Ask For Age
# age = input("How old are you: ")
# if age:
# age = int(age)
# if age >= 18 and age < 21:
# print("You can enter, but need a wristband!")
# elif age >= 21:
# print("You are good to enter and can drink")
# else:
# print("You can't come in")
# else:
# print("Please enter a age!")
# A... |
dd06d67e3566e70a0e6c41ca3a2a3fa076918ab6 | 210eebf6f90bbbbe8bee7c34f56498305da1ea44 | agiledevteam/metr2 | /tasks.py | Python | py | 1,230 | no_license | import time, threading
from metrapp import app
import git
from metrapp import database as db
from pickle import loads, dumps
from redis import Redis
import logging
logger = logging.getLogger("tasks")
logger.addHandler(logging.FileHandler('tasks.log'))
redis = Redis()
def task(f):
def queue(*args, **kwargs):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.