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 |
|---|---|---|---|---|---|---|---|---|
98553b33613e2f2f8f5ac4c8c53c0fde51c9f289 | 8d1071135d13509724c7f65bcde74699e7defc5c | zeevro/pywinauth | /tests.py | Python | py | 8,214 | permissive | from base64 import b32encode
from binascii import hexlify
from hashlib import sha1, sha256
from unittest import TestCase, main
from unittest.mock import patch, mock_open, Mock
from urllib.parse import urlparse, parse_qs
from uuid import uuid4
import winauth
SECRET_BYTES = b'abcde'
SECRET_HEX = hexlify(SECRET_BYTES).... |
97d1308e2383e112aca85612a02ec3671b0d5a1b | 710f62bf72213f5d2517caad22fbe12b5fb08a9e | kepcer/sztZal | /SZTzal/mysite/mysite/settings.py | Python | py | 3,752 | no_license | """
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... |
a70df46d56882a2f1133b532e2c133da99c9a53a | 8deca7e9cb26bbbce962e5e16319185b60b50a48 | johannessonlab/Marasmius_mutation_paper | /misc_scripts/hisat2-bed2gff.py | Python | py | 1,632 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
hisat2-bed2gff.py
Version 0.1
Author: Markus Hiltunen
E-mail: markus.hiltunen@ebc.uu.se
This script converts the bed file produced by hisat2 with the option
--novel-splicesite-outfile to a gff format compatible with e.g. GeneMark-ET.
Copyright (c) 2019, Johannesson l... |
f483bae970e5d16e5d8bf83f4b4699548b28eb0e | e4b4ae9b8dad4e4e77a2237e2839a4f4bb93f788 | vazdeazm/addons-server | /src/olympia/amo/tests/__init__.py | Python | py | 35,707 | no_license | # -*- coding: utf-8 -*-
import math
import os
import random
import shutil
import time
import uuid
from contextlib import contextmanager
from datetime import datetime, timedelta
from functools import partial, wraps
from tempfile import NamedTemporaryFile
from urlparse import parse_qs, urlparse, urlsplit, urlunsplit
fro... |
199fd509be1dd5e0d99fb1c87a24ba8a321e6323 | b49eb0db8ab84d0690bead24470f216f2f96a394 | dbruhno/LocalizaTarget | /localize_target.py | Python | py | 2,730 | no_license | import os
import json
def getPathPl():
return "iosPhotoLab/Localization free/"
def getPathVs():
return "iosPhotoLab/Resources-visagepro/Localization/"
def getContentForPath(path):
link = os.getcwd() + "/" + path
files = []
with os.scandir(link) as list:
for item in list:
if item.path.split('.')[-1] == "l... |
ac339ad4bcfd4b92f1cac8e294b73391c1302e73 | ed26189961f93cdccc64c3e7118830abf7115224 | zhangzongyan/python20180319 | /day16/udp_groupserver.py | Python | py | 512 | no_license | '''
作者: zhangzongyan
时间: 18-4-12
'''
import socket as s
import time
GROUP = "224.2.3.4"
PORT = 1234
# 创建报式套接字
serversd = s.socket(s.AF_INET, s.SOCK_DGRAM)
# 使得服务器实现组播
serversd.setsockopt(s.IPPROTO_IP, s.IP_MULTICAST_TTL, 255)
# serversd.setsockopt(s.IPPROTO_IP,
# s.IP_ADD_MEMBERSHIP,
# s.inet_aton(GROU... |
0b4904bda246536ae9ed213fb1d5f9f1a6bbecaf | daa6cf438840f78407fb52c00c16ee8bd376db1d | Sutekh-VtES/convert-test | /tools/dummy_pylint_msgs.py | Python | py | 2,272 | no_license | # -*- coding: utf-8 -*-
# vim:fileencoding=utf-8 ai ts=4 sts=4 et sw=4
# Copyright 2014 Neil Muller <drnlmuller+sutekh@gmail.com>
# Based on custom_raw.py from pylint, so the license is
# GPL v2 or later - see the COPYRIGHT file for details
"""Dummy message provider to stop older pylint versions complaining
about d... |
85c9c691191adf5fb8e52f66c2f854466c0d0b55 | 07d6873a128a7268461ec885aef39d2eb23cd68f | derek12356/project-manager | /accounts/forms.py | Python | py | 1,431 | no_license | from django import forms
from django.contrib.auth import(
authenticate,
get_user_model,
login,
logout,
)
User = get_user_model()
class UserLoginForm(forms.Form):
username = forms.CharField()
password = forms.CharField(widget = forms.PasswordInput)
def clean(self,*args, **kwargs):
username = self.cleaned_dat... |
aaf6c2b40821f2e975459ea729505af76df7051e | e6932a19ab2db681f8293a3731453e2cd17003f1 | DhuldevValekar3/ironic | /ironic/drivers/modules/iscsi_deploy.py | Python | py | 26,111 | permissive | # Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... |
f83d632edc830a20f41c173abb6d7fe80b6fa083 | 09ffe5e0fbd80ecf6684879d2313c914877edb5c | nomrand/thai | /python/image_classifier/tf/calltf.py | Python | py | 7,485 | permissive | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import sys
import numpy as np
import tensorflow as tf
from . import label_image
from . import retrain
toppath = os.path.dirname(os.path.dirname(__file__))
model_file = os.path.join(... |
a8e4b14691bf9757c13ef3eb1748d5ad9ba610b5 | aa41b67e30b68181c6084a7772ee21548f0b577d | Sang-Hoon-Pakr/Tensorflow_Study | /NMT_seq2seq_attention_kor2eng/loss.py | Python | py | 374 | no_license | import tensorflow as tf
optimizer = tf.keras.optimizers.Adam()
loss_object = tf.keras.losses.SparseCategoricalCrossentropy(
from_logits=True, reduction='none')
def loss_function(real, pred):
mask = tf.math.logical_not(tf.math.equal(real, 0))
loss_ = loss_object(real, pred)
mask = tf.cast(mask, dtype=loss_.... |
c04cbc0472f350d04fb3115e8d120cc778dfbc79 | a3d6b8eced3aaa42d1730e1858d918d3af102203 | feedzai/LightGBM | /tests/python_package_test/test_basic.py | Python | py | 13,138 | permissive | # coding: utf-8
import os
import tempfile
import unittest
import lightgbm as lgb
import numpy as np
from scipy import sparse
from sklearn.datasets import load_breast_cancer, dump_svmlight_file, load_svmlight_file
from sklearn.model_selection import train_test_split
class TestBasic(unittest.TestCase):
def test(... |
b010ed8f51188301ec5aceafe930e4f6c9853d7b | 96e26d8d9ad71962c3a5d69a1a87bb1c556b12e8 | ekalyanova/irwin-1 | /irwin/p_semiconductor_module/callbacks/DonorEnergyCallBackOperator.py | Python | py | 1,953 | no_license | from irwin.CalculationParameters import CalculationParameters
from irwin.CallbackOperator import CallbackOperator
from irwin.GUIParameters import GUIParameters
class DonorEnergyCallbackOperator(CallbackOperator):
def __init__(self):
self.window = None
self.parameters = CalculationParameters()
... |
cee482a0363b7e267498fcdda5537ad40180bf50 | dc6c74c482f59aefb0a1d28327b181dfc73d7cf6 | iamshivamgoswami/Random-DSA-Questions | /1257. Smallest Common Region.py | Python | py | 431 | no_license | class Solution:
def findSmallestRegion(self, regions: List[List[str]], region1: str, region2: str) -> str:
parents={region[i]:region[0] for region in regions for i in range(1,len(region))}
history={region2}
while region2 in parents:
region2=parents[region2]
history.a... |
4d434e5ee7e67f3e257b3c48985364b551d5d3c3 | e47cc11b81e559273aa2cd530bacdcd4a1be5e9e | patrickbryant/XhhCommon | /plotting/plotJESVars.py | Python | py | 4,343 | no_license | import optparse
parser = optparse.OptionParser()
parser.add_option('-o', '--out', dest="output", default="", help="")
parser.add_option('-i', '--in', dest="inputDir", default="", help="")
o, a = parser.parse_args()
import ROOT
import OfficialAtlasStyle
ROOT.gROO... |
ac5db77a3d095a35ccccbe0edf26e376a61749e2 | 2aba3dc5ced876c8c7109df931896ee601a66283 | Sen2k9/Algorithm-and-Problem-Solving | /coding_practice/find_averages_of_subarrays.py | Python | py | 666 | no_license | def find_averages_of_subarrays(arr, k):
if k == 0:
return []
_sum = sum(arr[:k])
ans = [(_sum) / k]
start = 1
end = k
while end < len(arr):
_sum = _sum - arr[start - 1] + arr[end]
ans.append((_sum) / k)
start += 1
end += 1
#print(ans)
return an... |
15049bd60fc75a3d37c010b74aa9365442535012 | 22b9b5dc0fbee3e2bd85d52cf57705e76397ec94 | MetaVai/pyccel | /tests/external/test_external.py | Python | py | 1,319 | permissive | # pylint: disable=missing-function-docstring, missing-module-docstring/
# coding: utf-8
# TODO test if compiler exists before running mpi, openacc
# execute the binary file
import pytest
from pyccel.codegen.pipeline import execute_pyccel
import os
def get_files_from_folder(foldername):
base_dir = os.path.d... |
7a0e3d287861b5db67662cc6b25c1654953f6c6b | 27f4265baf29a698a521ad0b6c7054fb54cb37f1 | oumar90/CesarPy | /cesar.py | Python | py | 3,663 | no_license | # Fonction de chiffrement d'un caractere
def cesar_chiffre_nombre(x,k):
return (x+k)%26
# Fonction de dechiffrement d'un caractere
def cesar_dechiffre_nombre(x,k):
return (x-k)%26
# Fonction de chiffrement d'une chaine de caractere
def cesar_chiffre_mot(mot, k):
mot_chiffre = [] #Liste vide
for lettre in mot: #po... |
12458fefad4023e09f88077a354598c46193e311 | e663715e5525ede575e33c373c7f859ec3412712 | 7Aishwarya/Data-Structures-and-Algorithms | /Hashmap/Jewels-and-stones.py | Python | py | 257 | no_license | class Solution(object):
def numJewelsInStones(self, J, S):
"""
:type J: str
:type S: str
:rtype: int
"""
count = 0
for i in S:
if i in J:
count += 1
return count |
be984e15d43cc0d4a113a3c5f0a563ce1d1f4175 | 85f2fcd36bb98b2c2163c76cb3e7f204f5b0c41b | BerilBBJ/scraperwiki-scraper-vault | /Users/R/Ravinder_kaur/list-argumentpy.py | Python | py | 3,850 | no_license | ###############################################################################
# START HERE: Tutorial 1: Getting used to the ScraperWiki editing interface.
# Follow the actions listed with -- BLOCK CAPITALS below.
###############################################################################
# ----------------------... |
d5c872f759ccf61fc19961a30bdb8fb4200afff6 | 8e172055f4ee04953f0dd4b80ce67d63c26e8747 | joannezhouyi/unsupervised_image_captioning | /misc/dataloader/onmt_dataset_h5.py | Python | py | 5,365 | no_license | from __future__ import division
import onmt.Constants
import numpy as np
import math
import torch
from torch.autograd import Variable
import misc.constants as constants
class onmt_dataset_h5(object):
"""
Manages dataset creation and usage.
Example:
`batch = data[batchnum]`
"""
def __in... |
23462b4605bb2781c343606718e871a5d322f94d | 3c59d6aa80487596662733afe83908d80e9f9fde | LowSalinas/SaludID | /GluteX/Apps/gestiondeusuarios/migrations/0005_auto_20191011_2326.py | Python | py | 838 | no_license | # Generated by Django 2.2.5 on 2019-10-12 04:26
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('gestiondeusuarios', '0004_auto_20191010_1255'),
]
operations = [
migrations.RemoveField(
model_name='numid',
name='Doctores'... |
99fa99854787ee451dc9680adfd646cc1d9c09a7 | 30f6cb5c689369522e6d7df8d54d32369bb1a4b6 | SuryaXanden/scorecardpy | /scorecardpy/scorecard.py | Python | py | 7,615 | permissive | # -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import re
from .condition_fun import *
from .woebin import woepoints_ply1
# coefficients in scorecard
def ab(points0=600, odds0=1/19, pdo=50):
# sigmoid function
# library(ggplot2)
# ggplot(data.frame(x = c(-5, 5)), aes(x)) + stat_function(fu... |
d30526c4fe978e6c4d6d0fc0851c38802aa3c83a | c6ffc0cab633f08e59c27744ccab9f876026cb80 | che-lab/che-covid19 | /covid_day_clean.py | Python | py | 1,551 | no_license | import os
import pandas as pd
#os.chdir('C:/Users/elmsc/Documents/gis/che-covid19')
os.chdir('/Users/geoffreyhughes/Projects/Work/COVID-19/che-covid19')
#path = 'data/COVID-19/csse_covid_19_data/csse_covid_19_daily_reports/'
path = 'data/'
# Stores all csvs as df within a dictionary
csv = [f for f in os.listdir(pat... |
26acb34f321fe21ba94fbbbdfb47ad69acd26057 | 7d58d616702b13adc58266f1fd63107ae3b9d8b0 | daniel-reich/ubiquitous-fiesta | /3JX75W5Xvun63RH9H_19.py | Python | py | 321 | no_license |
def describe_num(n):
arr = ["brilliant", "exciting", "fantastic", "virtuous", "heart-warming", "tear-jerking", "beautiful", "exhilarating", "emotional", "inspiring"]
brr = []
for i in range(1, 11):
if n % i == 0:
brr.append(arr[i-1])
return "The most " + " ".join(brr) + " number is {}!".format(n)
... |
c00a46814092bc8224f15bdff344724350bdb2fc | a7e9e3b2de55aaa8e73dd4b1169795b0c515f7b7 | ZhangJun93/dataSpider | /dataSpider/spiders/ofweek_jqr_spider.py | Python | py | 2,119 | no_license | # -*- coding: utf-8 -*-
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
from scrapy.loader import ItemLoader
from scrapy.spiders import CrawlSpider, Request
from ..items import SpiderItem, spidermd5, removern
import time
from dataSpider.misc.baseSpider import BaseSpider
import re... |
419c591613a1892320023f614fb6715ba800c275 | ddfd03bd1c42e7ec429bf063db9a4fe8d6740fd2 | ugoood/BigMass | /Python_Study/Pywork/xiang_py_code/four_two_while_range.py | Python | py | 754 | no_license | # -*- coding:utf-8 -*-
'''
Created on 2017年2月9日
@author: xiang
'''
# while loop
count = 10
guess_flag = True
while guess_flag:
count = count-1
if count == 0:
guess_flag = False
print("while loop will be over !")
print('Xiang is handsome!')
# in a loop:
# break: stop running the rest code i... |
cdfc062982eb8b6f4f7c1f9ae64d8b249f59044c | a74ba1fb003d186d589bbcb380d88f3055d5d8ac | vitoryeso/ECT-proj-cnn-vant | /safe_distance/object_trackers/centroidTracker.py | Python | py | 3,846 | no_license | import cv2 as cv
import numpy as np
from scipy.spatial import distance
from collections import OrderedDict
class CentroidTracker():
def __init__(self, maxDisappeared=30):
# the id of the next object to be included
self.nextObjectID = 0
# dictionary like:
# {id: (centroid_... |
e9c047f895673a1cd00dc2fd39659f7682d9bd14 | 052245cdd4a8244daa91b8d80e89c10ceb8f9716 | aly202012/imgclsmob | /tensorflow2/tf2cv/models/model_store.py | Python | py | 66,178 | permissive | """
Model store which provides pretrained models.
"""
__all__ = ['get_model_file']
import os
import zipfile
import logging
import hashlib
_model_sha1 = {name: (error, checksum, repo_release_tag, ds, scale) for
name, error, checksum, repo_release_tag, ds, scale in [
('alexnet', '1609', '8ae4618... |
7a71c3a423944dfd000f8419b64c8e8afb227505 | 565317f996b38b710a8f88913df9ec198c9f3aec | d-fan/cs181-practical-3 | /user_median.py | Python | py | 1,752 | no_license | import numpy as np
import csv
# Predict via the user-specific median.
# If the user has no data, use the global median.
train_file = 'train.csv'
test_file = 'test.csv'
soln_file = 'user_median.csv'
# Load the training data.
train_data = {}
with open(train_file, 'r') as train_fh:
train_csv = csv.reader(train_fh... |
e3698db9a102c0133fa884ba6b79036bcb8b400f | 3cd8d4eb4f99215f780b7f088389c058d3a8f089 | xujunxi/YOLOv4-Mask-RCNN-Object-Detection-and-Image-Processing | /utils/dataloader.py | Python | py | 9,842 | no_license | from random import shuffle
import numpy as np
import torch
import torch.nn as nn
import math
import torch.nn.functional as F
from PIL import Image
from torch.autograd import Variable
from torch.utils.data import DataLoader
from torch.utils.data.dataset import Dataset
from utils.utils import bbox_iou, merge_bboxes
from ... |
5e9ae5fba4241a804693e8a7273acc31810a5af0 | 7f6e836db853067e566f7008fe95bd2e2318bacd | Wolfonye/PythonFristSteps | /datenbanktests/lib/python3.5/site-packages/pg.py | Python | py | 91,914 | no_license | #! /usr/bin/python
#
# pg.py
#
# $Id: pg.py 886 2016-09-08 16:04:53Z cito $
#
"""PyGreSQL classic interface.
This pg module implements some basic database management stuff.
It includes the _pg module and builds on it, providing the higher
level wrapper class named DB with additional functionality.
This is known as th... |
4a473f0b516b81de4e91cd043af56b97e43fe000 | affce07d1ab59258ae3c279de039514fd8adbc6a | alma957/Campus-Collect | /src/main/venueobjects/getVenueCountByTag.py | Python | py | 1,010 | no_license | from botocore.exceptions import ClientError
from boto3.dynamodb.conditions import Key, Attr
from main.lambdautils.BaseLambdaHandler import BaseLambdaHandler
import json
class GetVenueCountByTagHandler(BaseLambdaHandler):
def __init__(self, dbObject):
super().__init__(dbObject)
def handle_request(self... |
d953b59affdc41f7a6ed8250efb40663d667a178 | 9e271de106fc32bb8803dca89391ffe724d6d729 | eocdb/ocdb-server | /ocdb/db/mongo_query_generator.py | Python | py | 3,486 | permissive | from typing import Optional, List
from ocdb.core import QueryVisitor
from ocdb.core.query.query import FieldWildcardQuery, T, FieldRangeQuery, FieldValueQuery, UnaryOpQuery, BinaryOpQuery, \
PhraseQuery
class MongoQueryGenerator(QueryVisitor[str]):
plain_fields = ["path", "submission_id", "status", "pgroup",... |
6eef12ed8ef4a848dac81b8a8238f3df3df0134a | e2b709e3177798d39e211e51328531471332da27 | i-MaTh/mpt-demo | /lib/tools/demo_rfcn.py | Python | py | 5,057 | no_license | #!/usr/bin/env python
# --------------------------------------------------------
# R-FCN
# Copyright (c) 2016 Yuwen Xiong
# Licensed under The MIT License [see LICENSE for details]
# Written by Yuwen Xiong
# --------------------------------------------------------
"""
Demo script showing detections in sample images.
... |
b54489a8cac3123c8eba9d055115327241588f9d | d10c6d94640856ada3ae7c88242788b6b9d032b1 | madmadcat/QtCookBook_Demo | /my_notes/09.窗口位置提示工具.py | Python | py | 4,416 | no_license | #!/usr/bin/env python37
# -*- coding: utf-8 -*-
"""
Author : xdong@wandtec.com
date: 2021/1/30
Change Activity:
2021/1/30:
"""
from PyQt5.Qt import *
class PosionTool(QWidget):
"""
实时更新坐标系,通过重写moveevent和resizeevent事件实现
"""
def __init__(self):
super... |
32f30476a3a54fb0ac987af2cd9e2c8a83aa6e2d | f9434b17cea3a337cc2697a0e361d167689fa22b | rdboyes/mit-deep-learning | /DeepR/segment_image.py | Python | py | 6,813 | permissive | # Tensorflow
import tensorflow as tf
print(tf.__version__)
# I/O libraries
import os
import tarfile
import tempfile
from six.moves import urllib
# Helper libraries
from matplotlib import gridspec
from matplotlib import pyplot as plt
import numpy as np
from PIL import Image
import cv2 as cv
# Comment this out if you ... |
ac65a05e207b61c9ef0cb48091eba3deaa4ad885 | c16e3640f1b3f0bd3489f43d6cc74f6212c36d60 | alice1017/load-template | /setup.py | Python | py | 846 | permissive | #!/usr/bin/env python
# coding: utf-8
from setuptools import setup
from load_template import __author__, __version__
setup(
name="load-template",
author=__author__,
author_email="takemehighermore@gmail.com",
description="Create a file from the template with the variables.",
version=__version__,
... |
5f058eb78cd1e38268a81c9a3d922e72922b4e9d | c4311505a3b88fa05c0ded9c47e789879930e9c4 | silviosnjr/Python-parte5-IO | /teste_excecoes.py | Python | py | 413 | no_license | try :
with open("dados/contato.csv", encoding="latin_1") as arquivo :
for linha in arquivo:
print(linha, end="")
arquivo.write("3,Bento José, bento@bento.com.br")
arquivo.seek(0)
for linha in arquivo:
print(linha, end="")
except FileNotFoundError:
print... |
d2f155d420ddb42bf80ccbfe1e1528de4f382b80 | c27be852e09c9e9166cab659c439971b3cb916a2 | davidxn/doomanalyzer | /measure.py | Python | py | 6,879 | no_license | from omg import *
import sys
import json
thing_defs = {}
def output_header():
headers = ["Map", "Size"]
for skill_name in ["easy", "medium", "hard"]:
headers.append(skill_name + "HealthPoints")
headers.append(skill_name + "MonsterPoints")
headers.append(skill_name + "AmmoP... |
197834dbadd4b85dae31aeda412746beb5854a1a | a8103a8e3b2c72a9a5500914ade8d5575ba3dbcb | liupibm/qiskit-aqua | /test/test_qsvm_kernel.py | Python | py | 14,151 | permissive | # -*- coding: utf-8 -*-
# Copyright 2018 IBM.
#
# 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 agre... |
7898d70ce78eaaea50fe59bd77d9f4f68a5cedf1 | 25b6f168258dc18043e813b33d986015365f934f | backtracker/TencentComicBook | /onepiece/utils/img2pdf.py | Python | py | 1,567 | permissive | import os
from reportlab.lib.pagesizes import A4, portrait
from reportlab.lib.utils import ImageReader
from reportlab.pdfgen import canvas
def imgs_to_pdf(output, img_path_list):
"""将一组图片合成一个pdf文件
Args:
output: 输出pdf文件路径
img_path_list: 要合成的图片的路径列表
Returns:
output: 输出pdf文件路径
"""... |
8771f71a69f3afdc5de4d38db6efe61b553ae880 | 5b099581d998ed73860db0354064493d74e82e78 | jsillin/plotting | /gfs_hrly_h5.py | Python | py | 9,096 | no_license | import cartopy.crs as ccrs
import cartopy.feature as cfeature
import numpy as np
import matplotlib.pyplot as plt
import netCDF4
import xarray as xr
import metpy
from datetime import datetime
import datetime as dt
from metpy.units import units
import scipy.ndimage as ndimage
from metpy.plots import USCOUNTIES... |
25cff9ef14301ccc0ca51468e2aef921b0a75ae8 | 9d4cc1de7b83922661d2624d78331ee71bdf5c69 | yh97yhyh/AndroidAppCloudStudy | /data_crawler/csv_test.py | Python | py | 637 | no_license | import csv
import pymysql
file = open('police.csv', 'r', encoding='utf-8')
reader = csv.reader(file)
con = pymysql.connect(host='localhost', user='root',
password='1539', db='crawl_data', charset='utf8')
cursor = con.cursor() # 한 줄씩 수행
sql = """INSERT INTO police(title, tel, homepage, roadaddr... |
389777188e92def1c7201786de2b522162651f26 | cd409f72166501339083d55b3e2321e0ab7f5ea9 | Pranav-Agarkar/app-django-vue | /backend/app/models.py | Python | py | 214 | no_license | from django.db import models
# Create your models here.
class Posts (models.Model):
title = models.CharField(max_length=250)
content = models.TextField()
def __str__(self):
return self.title
|
5324035acb3967ff7b9af67b3e99b71b92c2f268 | 23dda3416e32ae7375cf9097afdef169ab9333a2 | Laga/mysqltotsv | /tests/basic.py | Python | py | 1,716 | permissive | import argparse
from mysqltotsv import Splitter, ProcessAST, row_strip_quotes
class MockArgs:
def __init__(self): pass
def test_ProcessAST_type_conversion():
p = ProcessAST()
class o:
def __init__(self): pass
o1 = o()
o1.value = '123'
assert type(p.cell([o1])) == int
o1.value = '12... |
fa4708e0f50b3ad85c312266743b18a061b871d8 | d0bc7dcad36ab595b1c3959f74f3ee80c210982b | JoonHyeongPark/IMMethyl | /CpG site Correlation/Separation Version/P_Code_Server4_PANCANCER_7.py | Python | py | 9,006 | permissive | # -*- coding: utf-8 -*-
cancerlist = ["PANCANCER"] # server1
from operator import itemgetter
from scipy import stats
import numpy as np
betavalue_arr = []
cytoact_arr = []
probe_name = []
sample_id = []
start_number = 222000
SEP_NAME = ".SEP_4.7."
probe_count = 6000
sample_count = 0
probe_separation_number = 100... |
f10262cba56aa68792e8eca9c6c3e4c86e4ab0ab | 07dcd5d709a28c34318f190e9e11c84b3f084fb7 | manji-0/atcoder | /abc/118/c.py | Python | py | 328 | no_license | def main():
N = int(input())
A = [ int(i) for i in input().split() ]
mi = min(A)
f = True
while f:
A = [ i % mi if i % mi != 0 else mi for i in A ]
m = min(A)
if mi == m:
f = False
else:
mi = m
print(mi)
if __name__ == '__main__':
... |
2451912453d46684f6d7b27b8df0a6f30a1344c9 | f986313af849a6d2b30df2fabed695f0ca036d3c | breuleux/myia | /tests/frontends/test_all_ops.py | Python | py | 25,735 | permissive | from copy import copy
from types import FunctionType
import numpy as np
import pytest
from myia.abstract import AbstractArray, from_value
from myia.abstract.data import (
ANYTHING,
SHAPE,
TYPE,
VALUE,
AbstractScalar,
AbstractTuple,
)
from myia.debug.finite_diff import NoTestGrad, clean_args
fr... |
8ce949c3c83564714ead3e4798be082ca4666a2d | 239379cebd5f4090f62134aa304dc8b6244dcb5c | giffels/PRODCOMMON | /src/python/ProdCommon/BossLite/API/BossLitePoolDB.py | Python | py | 2,718 | no_license | #!/usr/bin/env python
"""
_BossLitePoolDB_
"""
__version__ = "$Id: BossLitePoolDB.py,v 1.0 2008/07/11 15:41:45 gcodispo Exp $"
__revision__ = "$Revision: 1.0 $"
__author__ = "Giuseppe.Codispoti@bo.infn.it"
import logging
from os.path import expandvars
# Database imports
from ProdCommon.Database.SafeSession import S... |
143ecc0200b33f207033bb504dcadf4b7194036d | 731293a7d8df2d54c2bf82a2c6367f5c13850ca4 | awstown/ecsspawner-1 | /ecsspawner/ecsspawner.py | Python | py | 6,732 | no_license | import boto3
from tornado import gen
from jupyterhub.spawner import Spawner
from traitlets import (
Dict,
Unicode,
List,
Bool,
Int,
)
class ECSSpawner(Spawner):
ecs_client = boto3.client("ecs")
ec2_client = boto3.client('ec2')
cluster_name = Unicode("notebook-cluster",
... |
e1830472cc4e6b962ae74012f13a8e963da40807 | 474f2f944b4b849969d6ea573d143dde4d674732 | Manasa-17-2000/electricitybill | /main.py | Python | py | 711 | no_license | #program to calculate eb bill
unit = unit = int(input("enter the unit : "))
if unit >= 0 and unit <= 30:
charge = unit*3.75+(5/100)
fixedcharge = 60
final = charge + fixedcharge
print("eletricity bill =" % final)
elif unit >= 30 and unit <= 100:
charge = 5.2*unit+(5/100)
fixedcharge... |
c14914fec491cf5090d7404d95633c827109e065 | bd3f815c62dc023acc252a3d9c795848a4b06e9c | HishamDigitalHub/SportActivities | /UserRegistrationApp/migrations/0050_remove_preference_user.py | Python | py | 342 | no_license | # Generated by Django 2.1.1 on 2018-10-24 13:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('UserRegistrationApp', '0049_auto_20181024_1629'),
]
operations = [
migrations.RemoveField(
model_name='preference',
name='us... |
164ed363e74327dc9034e72dba035e18e966d9e0 | 8630136ef256075f6d83e934b9bb2e30f8d22ef6 | faninSM/PaddleSlim | /tests/test_sa_nas.py | Python | py | 4,107 | no_license | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
1d297ecec0616e4becbc25337f081759a47c47f3 | 4e30da4cde08d18e7bddc91062a3e058fbf0288d | diegozambrana/snowflake-connector-python | /test/test_unit_datetime.py | Python | py | 3,459 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2018 Snowflake Computing Inc. All right reserved.
#
import time
from datetime import datetime
from snowflake.connector import sfdatetime
def test_basic_datetime_format():
"""
Datetime format basic
"""
# date
value = datetime(201... |
b88769d798e6961d5e819039ac1d1138c4f84570 | d42f29a91ff50b6cb08582feb721f82416eef4f6 | KayafasKain/djangoshory | /shortly/shortlink/forms.py | Python | py | 773 | no_license | from django import forms
from .models import Link
from .utils import check_url_util as ch_url
class CreateLinkModelForm(forms.ModelForm):
class Meta:
model = Link
fields = ['basic_link']
labels = {'here goes link, you want to get shorter'}
help_texts = {'pass your link here and pres... |
cb57947c3da95574822335977d1dfed45fb9aa12 | 395aac87ffef080c8902bbde3736d3143a90d8a6 | AlexKirsh/CryoEM-CommunityDetection | /Community_Detection_Testing/FluidC_LFR.py | Python | py | 1,753 | no_license | import networkx as nx
import matplotlib.pyplot as plt
import networkx.algorithms.community as nx_comm
from sklearn.metrics.cluster import normalized_mutual_info_score
#Set up LFR graph
n = 100
tau1 = 3
tau2 = 1.5
mu = 0.1
G = nx.LFR_benchmark_graph(n, tau1, tau2, mu, min_degree=5, min_community=25, seed=10)
#Extract ... |
058915cf8fef8261dba6dd3cc0dbf403b9a98938 | b86355ff5f75d951272be3111955b52de41c53ab | TidosDK/Python-Macro | /Macro-mouse.py | Python | py | 4,067 | no_license | # Copyright by Mathias Nicolajsen
# Code by Mathias Nicolajsen
# Imports
from pynput.mouse import Button, Controller
import keyboard
import time
import os
from threading import Thread
# ASCII art for a better interface
mouse_ASCII = {
"l":
"""
||
||
.---------.--------.
| ####### ... |
6a39b3e79182545ef856a2c3f1575d7bad336648 | 700780b7efca0807b9678b043407c22a0d95924b | markarmanious/comp2005Proj | /finalsubmission/flaskr/flaskr/tests/test_userGroup.py | Python | py | 2,240 | no_license | import os
import sys
sys.path.append('../')
import userGroups
import unittest
class UserGroupTestCase(unittest.TestCase):
def setUp(self):
userGroups.dataBase = 'testdb.db'
userGroups.schema = 'flaskr/schema.sql'
userGroups.init_userGroupsDB()
self.group = 'group1'
self.mem... |
236d3eeb5e8c82fc5841126626d2de11f65c8983 | 470ea4a9ba91e8eb699764b64530c547164174b0 | crowdbotics-apps/fancy-hill-27542 | /backend/fancy_hill_27542/wsgi.py | Python | py | 409 | no_license | """
WSGI config for fancy_hill_27542 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.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJA... |
50f13a3bc470c512b69610675a8171d88f3cad02 | 4233dbc0b2a3ff2159517ff76f2020d380fb863c | WillBerner/Server-Client | /Assignment2/TCPClient.py | Python | py | 636 | permissive | import sys
from socket import *
for line in sys.stdin:
if len(line) == 0: break
clientSocket = socket(AF_INET, SOCK_STREAM)
hostPort = 15132
host_name = "comp431bfa19"
clientSocket.connect((host_name, hostPort))
stream = clientSocket.makefile('rw')
# write the input line to the server
... |
f1be27e3272e8b3c0c702b82ff34b2c3bfb6efe4 | 137919c2cdd0e925f0a8339c2d7db34213dc0355 | thegamingcoder/leetcode | /474.ones-and-zeroes.py | Python | py | 1,408 | no_license | #
# [474] Ones and Zeroes
#
# https://leetcode.com/problems/ones-and-zeroes/description/
#
# algorithms
# Medium (38.85%)
# Total Accepted: 22.4K
# Total Submissions: 57.6K
# Testcase Example: '["10","0001","111001","1","0"]\n5\n3'
#
# In the computer world, use restricted resource you have to generate maximum
# be... |
45ea23d2da1785b9aa5e9332629eb918a90bf3b5 | c11d6284c0c93ad390fffb10504f237eba42c7ed | 8v060htwyc/django | /django/contrib/contenttypes/fields.py | Python | py | 24,276 | permissive | from __future__ import unicode_literals
from collections import defaultdict
from django.contrib.contenttypes.models import ContentType
from django.core import checks
from django.core.exceptions import FieldDoesNotExist, ObjectDoesNotExist
from django.db import DEFAULT_DB_ALIAS, connection, models, router, transaction... |
aaaa6cab13e3c297d632757d2f84047fbd8d9757 | 3f26a21bd0f6170da9f45747f6e9629de78b737e | Avidereta/skoltech | /term3/Bayesian Methods/bm_pset4/myKMeans.py | Python | py | 3,741 | no_license | import numpy as np
from sklearn.linear_model.base import BaseEstimator
from numpy.testing import assert_approx_equal
from scipy.stats import multivariate_normal
from scipy.spatial.distance import cdist
from scipy.misc import logsumexp
from utils import compute_labels, log_likelihood, log_likelihood_from_labels
from ab... |
b8ff70c30888a8cbb0a9535bfd5e8c41e5868e2e | 06538ae1239200bf47e00e06a68f0fabb1606efe | xlos/monitor_news | /monitor_from_naver.py | Python | py | 7,849 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import datetime
import io
import os
import json
import requests
import base64
import sys
import re
import traceback
import urllib2, urllib
from bs4 import BeautifulSoup
from urlparse import urljoin
class Crawl:
delayTime=1
def __init__(self):
... |
e160526322305b89d161116c0306229fc2988f93 | 0ad91b05f343d3f4fb0c161bdbf66abdd4e62a60 | Shubh-13/Sudoku_Solver | /Flask_api.py | Python | py | 1,213 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 3 17:22:24 2020
@author: pushkara
"""
from flask import Flask,send_file, request, render_template
from werkzeug.utils import secure_filename
from gevent.pywsgi import WSGIServer
import os
from image_processing import print_to_image
from io import S... |
7ce7ad09e3e5f1d5a86fad8f468c98491acb2851 | b5d02ac1a8968dd7d102f43ec23c5699380b1738 | fagan2888/Face-Recognition-1 | /encode_faces.py | Python | py | 1,807 | no_license | from imutils import paths
import face_recognition
import argparse
import pickle
import cv2
import os
ap = argparse.ArgumentParser()
ap.add_argument("-i","--dataset", required=True, help= "path to input directory of faces+images")
ap.add_argument("-e", "--encodings", required=True, help="path to serialised db of facial... |
f005ee96f4235d43a029b140ba0988ac9627d6d6 | a98bca288ab4db2b0e209714cd0fb6b92ba6c36a | zhra46/crnn.pytorch | /demo.py | Python | py | 1,062 | permissive | import torch
from torch.autograd import Variable
import utils
import dataset
from PIL import Image
import models.crnn as crnn
model_path = './data/crnn.pth'
img_path = './data/637.jpg'
alphabet = '0123456789abcdefghijklmnopqrstuvwxyz'
model = crnn.CRNN(32, 1, 37, 256)
if torch.cuda.is_available():
model = model... |
3a5cad92cc2862e81ba48d9dfb207c2838dcd087 | 0f19e92ff34bd7f99bf58b97d3bcbfee81d8af8f | Halicea/HaliceaMVCHelper | /src/halicea/tests/BlockLocatorTestCases.py | Python | py | 1,317 | no_license | import unittest
from halicea.lib.codeBlocksHelpers import *
class BlockLocatorTestCase(unittest.TestCase):
def setUp(self):
self.blockContent="""first
second
thirt
fourth
fifth"""
self.getTmpl = """$blindent## $blockname ##
#content#
$blindent## end_$blockname ##
"""
def beginMatch(line):
... |
3aaee228b11cfbbe92bd7ccc1d6c6a1a83346d65 | 311c287cd709a779ce7f3a8391e48a6d77a5c528 | palashgo/libtorrent | /tools/set_version.py | Python | py | 2,903 | permissive | #!/usr/bin/env python
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import os
import sys
import glob
import re
version = (int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]))
def v(version):
ret = ()
for i in version:
if i < 10:
ret = ret + (chr(ord('0') + i),)... |
4ec814d68f5253bb2804a6e35828ccf88fcc431d | c183ea4ad7c7428a71af1dc73011a8c55a13a9a9 | mbohlool/k8s-clients | /python/k8sclient/models/v1beta1_job_spec.py | Python | py | 10,270 | permissive | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: unversioned
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "Licens... |
0277b8a66ad1f1478e09a74980db411ad9086704 | fe5d4fc5d31b6a5fedc16957846994707cac51ef | sevennothing/aliyunTestPrj | /alisdk/top/api/rest/WlbTradeorderGetRequest.py | Python | py | 367 | no_license | '''
Created by auto_sdk on 2014-11-20 12:53:43
'''
from top.api.base import RestApi
class WlbTradeorderGetRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.sub_trade_id = None
self.trade_id = None
self.trade_type = None
def getapiname... |
dc667ccd2e45beb3d648d608c8fb8071e3bfb64a | 159cbbee6366de53d9e3f109595959322a0c793e | genians-rnd/content | /Tests/mock_server.py | Python | py | 22,311 | permissive | from __future__ import print_function
import ast
import os
import json
import signal
import string
import time
import unicodedata
import urllib3
import demisto_client.demisto_api
from subprocess import call, Popen, PIPE, check_call, check_output, CalledProcessError, STDOUT
from demisto_sdk.commands.common.tools import... |
c0ca5aba9467c90f462b4adb5bcb8a7611dc4ba0 | 06fab8164b492a5b5af365e64cfea93d818c8185 | gauravgulati15/CustomerManagementApp_Django | /cma/accounts/forms.py | Python | py | 548 | no_license | from django.forms import ModelForm
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django import forms
from .models import *
class CustomerForm(ModelForm):
class Meta:
model = Customer
fields = '__all__'
exclude = ['user']
class O... |
5b4c37f99e674b8a01478e2fa549eb65f9aff01e | d3f1ef5c0a25038c932c1afaf65d704727b33a8a | SeeDCharlie/siamco | /manage.py | Python | py | 662 | no_license | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'siamco.settings')
try:
from django.core.management import execute_from_command_line
except Impor... |
8fe99e2ae14fc6ca592d012a6a217f3c65323184 | c73fd6871461594bc4f7868710f8af1a27acd19b | fabianchs/python-exercises-review | /exercises/07-Create-a-Basic-HTML/app.py | Python | py | 206 | no_license | a = '</title>'
b = '</html>'
c = '<head>'
d = '</body>'
e = '<html>'
f = '</head>'
g = '<title>'
h = '<body>'
# ⬆ DON'T CHANGE THE CODE ABOVE ⬆
# ↓ start coding below here ↓
print(e+c+g+a+f+h+d+b) |
a2ba96f34a7b95183f43eefe56bdde82b038e1cf | f1d544aa95b90a85127043031be429198f0240b0 | mfkiwl/rtl-sdr-demo | /signal_processor.py | Python | py | 5,146 | no_license | # Brady Langdale FSR Demo
import sys
import os
import time
# Math support
import numpy as np
# Signal processing support
from scipy import fft,ifft
from scipy import signal
from scipy.signal import correlate
from pyargus import directionEstimation as de
from pyapril import channelPreparation as cp
from pyapril imp... |
2e6cf94f6359e58ede02d1fee2c9a010d74d6310 | 816dcd1e44d6e0d1d0c1df9ef58474ebc1cc3233 | Olvi73/PythonAlgorithm | /Code/12.key2value.py | Python | py | 356 | permissive | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 10:22:51 2020
@author: Oliver
"""
x={'1':'one','2':'two','3':'three','name':'python','tool':'markdown'}
key=input("输入键:")
try:
print(x[key])
except:
print("您输入的键不存在!")
# value=input('输入值:')
# print(list(x.keys())[list(x.values()).index(va... |
859ab91a2a98d4d546d5120a51846ee0bd6312b2 | 78f4a0774e5899165d1791e1352c8d312825cc53 | Primekun/Quant_stock | /misc/arg_handler.py | Python | py | 1,796 | permissive | import argparse
from pipeline import backtest
from pipeline.backtest import TestStrategy
from pipeline.strategies.ff_strat import FeedforwardStrategy
from scripts import feedforward_nn
from scripts import data_process as dp
def arg_parser():
parser = argparse.ArgumentParser(description="Stock prediction model", f... |
5f8e4af39a289163037e74b517ec7b3a6bba7b9d | a73a33f1b0dd67807b655e5cf781d03c64f382d0 | yaoxiaohappy/Algorithm_python | /algorithm/meachineLearning/ANN.py | Python | py | 1,151 | no_license | # -*- coding: utf-8 -*-
import sklearn
from sklearn.neural_network import MLPClassifier
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn import datasets
import pandas as pd
import numpy
def getData_1():
iris = datasets.load_iris()
X = iris.data #样本特征矩阵,150*... |
73063a49cca1c1b226db470a18a76d9c1b8c0257 | 8c9c2231b6be9d9559f8b4ad77d134fe2a52c9f9 | andywar65/pymba | /migrations/0001_initial.py | Python | py | 2,473 | permissive | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-01-16 20:10
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtailcore'... |
b4cf22b6d7e19041aca4b8c961610af8ca1c1cb8 | 6ec1bb8fb862e381db1e08f025cd2db2d00b5c85 | inhan05053/Image-processing | /영상처리_모든_코드_파일/ip_2/my_histogram.py | Python | py | 2,839 | no_license | from collections import deque
import numpy
import numpy as np
import cv2
import matplotlib.pyplot as plt
def my_calcHist(src):
(h,w) = src.shape[:2]
hist = np.zeros((256, ) , dtype = np.int64)
for row in range(h) :
for col in range(w):
intensity = src[row,col]
hist[intensit... |
576a73f7224d2ba5e69526b8c91d8acf5cb65a2c | c4614dedaaf0b6ce2c1171fedb2ca42da6ff2495 | rchamorro/pulumi-azure-nextgen | /sdk/python/pulumi_azure_nextgen/apimanagement/v20180601preview/tag_by_product.py | Python | py | 5,561 | permissive | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__a... |
1aed7b3929ee94d775730be94bd97d78acf81562 | d6bf34a39db6d5aebd619c0bdda1144f446fd0b4 | olofmeister442/temp | /engine/views.py | Python | py | 105,135 | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import calendar
import csv
import logging
import random
from datetime import date, timedelta
import editdistance
import xmltodict
import pandas as pd
import math
import requests
import json
import uuid
import datetime
from pprint import pprint
from random import randint
from d... |
f90bd103888d4b39efa906064decfe8168bdef7d | 17be1efca0a768c2b48e92e1ded1c1aa761ede0c | pioella/Study | /0Test.py | Python | py | 1,048 | no_license | import copy
from tkinter import *
# root = Tk()
# root.title("Pioella")
# root.geometry("640x480+300+100")
# root.resizable(False, False)
# root.mainloop()
# list1 = ["이재훈", "이대희"]
# list2 = list1
#
# list1.append("박선영")
# print(list1)
# print(list2)
#
# r1 = ['hi', [180, 25], ('hello')]
# r2 = list(r1)
# print(type... |
065e025916dded12fefef91a2eb4e1896c9dfe4d | 9e6efc9c60ae88c5cf02ebc20e7b3ce67fcc4cda | Regis36/Regis-Enama-Computer-Science | /Soccer game .py | Python | py | 1,273 | no_license | import random
##Soccer game
'''
get the ball into the net and score within 10 moves while staying away from the defenders
'''
#Instructions
print("Welcome to Soccer")
Name= (input("please enter your team name: "))
print("Hello", Name, "You have stolen the ball from the other team and have to make your way through the... |
8b67dd0c11643089dca2a7d1f57dda14ee04e3c5 | e2864751ef73d4b6a916576951d494a5eccc0760 | UBERCRUZER/ai-strength-coach | /plan.py | Python | py | 463 | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 12 19:12:28 2019
@author: cruze
"""
class Workout:
def __init__(self, pct, repScheme):
self.pct = pct
self.repScheme = repScheme
def setWorkout(self, pct, repScheme):
self.pct = pct
self.repScheme = repScheme
def ... |
084f4ab04b144551cf7c6e22c9f15902ba590826 | 8b26310c63e87a90429b94fd4b1f0d79235ab7d3 | akostyukov/News-API | /src/news/permissions.py | Python | py | 393 | no_license | from rest_framework.permissions import SAFE_METHODS, BasePermission
class IsOwnerOrStaffOrReadOnly(BasePermission):
def has_object_permission(self, request, view, obj):
return bool(
request.method in SAFE_METHODS
or request.user
and request.user.is_authenticated
... |
76fa8fd37d6e429b26accaa66399449523dcf6e6 | 79e3155fb361abc5dd2187298bf785a61ada31ba | maguec/FraudDetectionDemo | /tests/test_data_generator.py | Python | py | 1,393 | permissive | import unittest
import redis
import pandas as pd
from app.demo import DataGenerator
class DataGeneratorTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
# Set up redis connection
cls.redis_conn = redis.Redis(host="localhost", port="6379")
if not cls.redis_conn.ping():
... |
2ed485fff53ed664c26a77f36466bdadcf442c3b | 80910c820c4dc88f5701b5ad87aebea6194c0b9a | KratosMultiphysics/Examples | /rom_application/tests/structural_static_test_files/FOM/structural_fom.py | Python | py | 1,622 | no_license | import os
import types
try:
import numpy as np
numpy_available = True
except:
numpy_available = False
import KratosMultiphysics
import KratosMultiphysics.KratosUnittest as KratosUnittest
import KratosMultiphysics.kratos_utilities as kratos_utilities
import KratosMultiphysics.RomApplication.rom_testing_uti... |
a2e9a1f33e691ab513b2516b1be6e96ae4aeb687 | 7cbd6bbc8f0dffff5baa121de712f3cef4358573 | blakecschmidt/Blackjack | /Blackjack.py | Python | py | 5,084 | no_license | import random
class Card:
def __init__(self, rank, suit):
if rank.isalpha() and rank != "A":
self.value = 10
elif rank == "A":
self.value = 11
else:
self.value = int(rank)
self.rank = rank
self.suit = suit
self.name = rank + suit
... |
f44f56bf5acaee0743cae247fb664c63e6c47dcc | 62c7d741fbcfeceb98427527708ac9bd4e7bcd57 | AntonioIsas/LearnPythonTheHardWay | /ex18.py | Python | py | 371 | no_license | def print_two(*args):
arg1, arg2 = args
print "arg1: %r, arg2: %r" % (arg1, arg2)
def print_two_again(arg1, arg2):
print "arg1: %r, arg2: %r" % (arg1, arg2)
def print_one(arg1):
print "arg1: %r" % arg1
def print_none():
print "I got nothin'."
print_two("Zed", "Shaw")
print_two_ag... |
03d3c0585cee491ede183e4cc1950ed8b8deac7b | c1f478996c7f7e3e23eb079a9723f37c99babb6e | MichalBrzozowski91/algorithms | /leetcode/easy/0617_Merge_Two_Binary_Trees.py | Python | py | 589 | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def mergeTrees(self, t1: TreeNode, t2: TreeNode) -> TreeNode:
if t1 and not t2:
return t... |
e3ece1dfdf6d51d3e4a4482a58b2b2e33ad157ce | 4247e79f35eb0275a7bcdd2b8a2fd44ad22ed8fd | lijjumathew/MSDS-Machine-Learning-2 | /HW/HW2-GridSearch/home_work_2.py | Python | py | 7,378 | no_license | import numpy as np
from sklearn import datasets
from sklearn.metrics import accuracy_score
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import KFold
from itertools import product
import matplotlib.pyplot ... |
11a7af0cd78c592dca948298bc3483f4e7597722 | 3fbd674d6e364aa5ee72cdfb81dffee521e56953 | djsilenceboy/LearnTest | /Python_Test/PySample1/com/djs/learn/basic/TestTextCoding.py | Python | py | 2,073 | permissive | '''
Created on Apr 6, 2016
@author: dj
'''
import unicodedata
def unicode_info(value):
name = unicodedata.name(value)
value2 = unicodedata.lookup(name)
print("value = '{}', name = '{}', value2 = '{}'".format(
value, name, value2))
print("-" * 40)
unicode_info('A')
unicode_info('$')
# Make su... |
fa93eb35c175ebf2b31c9540226df9b3f0c00ec6 | 586689a1e691f28aec5ec44dcf560b70d18fc1bf | cashgithubs/python_crawler-1 | /third_site_new_uid/_SYCM_ITEM_SUM_GET.py | Python | py | 1,733 | no_license | #!/usr/bin/python
# encoding:utf8
# All competitors
# Copyright(c)2012 vsu@opensuse.org
import sys,os,MySQLdb,time,datetime
import webbrowser
def getDate(delta_days=0):
date = (datetime.datetime.now()-datetime.timedelta(delta_days)).strftime("%Y-%m-%d")
return date
def openRecruit(url):
webbrowser.open... |
94a4339f527aaef00c1ca36805db39c88cf24f16 | 35c1c3511df12515b09820b3561e7adb586f8fa4 | jasonmhite/ocdsort2 | /test.py | Python | py | 3,067 | no_license | from unittest import mock
from copy import deepcopy as copy
from voluptuous import Invalid
from nose.tools import raises
from io import StringIO, TextIOWrapper
import ocdsort
CONFIG = """
config:
valid_extensions:
- mkv
destination: /test
threshold: 85
user:
uid: 1001
gid: 5000... |
4ba1cb08fee72f3813dc9617001e6e8d0be9d95c | 1e78a4b050e84fdffdb23cfc43ba996ca4833724 | Boondock19/Entregafinalproject5 | /capstone/MedicPlace/migrations/0001_initial.py | Python | py | 4,087 | no_license | # Generated by Django 3.1.3 on 2020-12-20 21:46
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
... |
8da21a5865b093b1b881cf725acc36b035e7cc96 | 234414f849b6081c909b88fe7d127b46f3cf6bf6 | raman325/apprise | /test/test_utils.py | Python | py | 41,198 | permissive | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Chris Caron <lead2gold@gmail.com>
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# 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 th... |
d102d4e692c92e26e805b182510bcd0f76885029 | e7da61e2294dafb6863ab18bf7d9768225721b8c | douglasrubims/Finance-Notification | /API/main.py | Python | py | 5,730 | no_license | from flask import Flask, request, jsonify, abort
from datetime import datetime, timezone
from dotenv import load_dotenv
from wallstreet import Stock
import requests
import pymongo
import urllib
import pytz
import time
import os
load_dotenv()
app = Flask(__name__)
database = pymongo.MongoClient(os.getenv('DATABASE_URL'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.