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 |
|---|---|---|---|---|---|---|---|---|
942983b48e8db502e0410e5052b2af39283a453c | 34142bec7b1b8dc21796597be65ddd617c6de1c6 | Allencheng01/GetTwLotteryHistory | /MyShuffleNet.py | Python | py | 9,287 | permissive | import os
import sys
import re
import numpy as np
import torch
import torch.nn as nn
try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url
import MyParam
__all__ = [
'ShuffleNetV2', 'shufflenet_v2_x0_5', 'shufflenet_v... |
068f1bdaf121497464b853855e6567818cd60a2d | bfbb79e4387d4394e2d63c862d9cc7c456066bce | williamFalcon/transformers | /examples/text-generation/pplm/run_pplm.py | Python | py | 28,106 | permissive | #! /usr/bin/env python3
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
a46421e87072b299f4ca4df8d86a15e0f29cb46c | 5eaeab441ab8519189f46260cf3ec9b347d8d267 | minhtran1309/structured_N2V | /src/files.py | Python | py | 2,281 | no_license | # from types import SimpleNamespace
from utils import flatten, recursive_map2
flowerdata = '/lustre/projects/project-broaddus/rawdata/artifacts/flower.tif'
flowerdir = '/lustre/projects/project-broaddus/denoise_experiments/flower/e01/'
## flower data
## flowerdir = '/Users/broaddus/Desktop/falconhome/denoise_exper... |
30425ee869417498b51e1962accf842ef469a352 | beedfe6e41e688bc2c1ab8d64c91b7a5ff7c46e3 | sarikamohan08/Python_Sorting_Algorithm | /Selection Sort.py | Python | py | 333 | no_license | #!/usr/bin/env python
# coding: utf-8
# In[2]:
#Selection Sort
import sys
A = [64, 25, 12, 22, 11]
for i in range(len(A)):
min_idx = i
for j in range(i+1, len(A)):
if A[min_idx] > A[j]:
min_idx = j
A[i], A[min_idx] = A[min_idx], A[i]
print ("Sorted array")
for i in range(len(A)):
print("%d" %A[i]),
... |
1715421186f3b86c8f4670ad505d642c78de7012 | 2d34eb6cbc8c35b6b8a3fa62a2b447711fd6e3e3 | sinhars/Data-Structures-And-Algorithms | /Course1/Week3/7_largest_number.py | Python | py | 1,216 | permissive | #Uses python3
import sys
import functools
import random
def compare_numbers(x, y):
combo1 = int(str(x) + str(y))
combo2 = int(str(y) + str(x))
return (combo2 - combo1)
def largest_number(a):
sorted_a = sorted(a, key=functools.cmp_to_key(compare_numbers))
res = "".join(sorted_a)
return... |
fc6cdfb9a46646349734263d24a90701fd4a1aa1 | b32765659379f0fe503e9bbe931b7cf57a861711 | alexef/wouso | /wouso/interface/top/models.py | Python | py | 4,357 | permissive | from datetime import datetime, timedelta
from django.db import models
from django.contrib.auth.models import User
from wouso.core.app import App
from wouso.core.user.models import Player, PlayerGroup
from wouso.interface import render_string
class ObjectHistory:
@property
def disabled(self):
return Top... |
abbd5c3f102814735c86350eea270d5f745d96fc | 23017be4cf57bf59ade3caa7d3e5a5b98d887839 | mboudiaf/imitation-driving | /code/ngsim_env_updated/rllab/algos/cem.py | Python | py | 5,881 | permissive | from rllab.algos.base import RLAlgorithm
import numpy as np
from rllab.misc.special import discount_cumsum
from rllab.sampler import parallel_sampler, stateful_pool
from rllab.sampler.utils import rollout
from rllab.core.serializable import Serializable
import rllab.misc.logger as logger
import rllab.plotter as plott... |
5ec2ed910d3ffb9d9f7747ed657cadb26baf4e94 | c47fc6c8d35485b2dbd2ff92c9ef0ce5ca453e8e | fcharming/myshop | /orders/migrations/0001_initial.py | Python | py | 1,860 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-12-29 06:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('shop', '0001_initial'),
]
operat... |
a07b57568efc49602ed5c48fb390868527d5aed3 | fa87691601dc50b18eb19213b59e7b993f317b05 | coskunrumeysa/py_example5 | /py_example5.py | Python | py | 241 | no_license | #Rümeysa Coşkun
#Python basit bir variables örneği
x=3
y=2
z="Hi,dikey"
if x > y:
print("Xbigger than from Y")
if y > x:
print("Y bigger than x ")
if x == y:
print("X equal to Y")
print(x)
print(y)
print(z)
|
fde6f3de0a32933879a5a5dd65564cfbf65dcf87 | b45d86062e317e14e495ba9da778b1b0253c0bea | jalexvig/cnn_backwork | /salient_features.py | Python | py | 1,909 | no_license | import tensorflow as tf
from proc_mnist import build_model, model_options
import numpy as np
def get_grads(model_options, x_vals, label):
x_vals = x_vals.reshape((-1, 28 ** 2))
params, x, y, layers = build_model(model_options)
softmax_layer = layers[-1]
softmax_label = softmax_layer[:, label]
g... |
b7d5205a5dce20db4d0aee082b240a643596a8a1 | a45535dd00f3c8fc808a87bd8d3dfb422c573371 | huaweicloud/huaweicloud-sdk-python-v3 | /huaweicloud-sdk-swr/huaweicloudsdkswr/v2/model/show_repos_resp.py | Python | py | 16,902 | permissive | # coding: utf-8
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ShowReposResp:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name... |
b57c8aaf0383851d444df567049caefcb14d0692 | 2df304a3def439a028278410710cdd5ffb1e9048 | Veronica9111/pyramid2 | /quiz.py | Python | py | 570 | no_license |
class Quiz_Handler:
def __init__(self, file):
self._file = file;
def get_items(self):
lines = []
quiz = []
lines = self._file.readlines()
for line in lines:
line = line.split(',')
(question, answer) = line[:2]
if question == "" and a... |
53a250ca051f535dca8f5c5f0793639d53203275 | 07e57a58b4d4cf6e5b5e8bf182c35a3924bb35f5 | chloejiwon/algorithm | /leetcode/532.py | Python | py | 514 | no_license |
class Solution(object):
def findPairs(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
if k<0:
return 0
counter = collections.Counter(nums)
if k==0:
cnt = 0
for i in counter:
if... |
befdbbd40022516c65624a9033e4b06ee62ac388 | 9252bf0c1cf8859d11cf982d5f9a746143430d2d | asad2200/rest-api | /SessionAuthenticationClass/SessionAuthenticationClass/urls.py | Python | py | 863 | no_license | """SessionAuthenticationClass URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name=... |
4f7d009f1a505541a78d5dbe26243c667335a485 | cc71f74232430b948422d3407e66f2bce1f8ea1d | nkpc14/NovUsMain | /rec_app/migrations/0002_auto_20190316_0256.py | Python | py | 764 | no_license | # Generated by Django 2.1.4 on 2019-03-16 09:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rec_app', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Hostel',
... |
8a48e2a6a7e63ea47dcca88ebaa6de07af3e7104 | af88329b47ec9cd0fa1cdb5d32e5ec496c01cced | imperialself/adventofcode2020 | /day02/part2.py | Python | py | 661 | no_license | # Find number of "valid" passwords
# https://adventofcode.com/2020/day/2
import re
with open('input') as file:
passwordlist = [line.rstrip('\n') for line in file]
# regexes
rLetter = '[a-z]'
rPos1 = '^[0-9]{1,}'
rPos2 = '\-[0-9]{1,}'
rPassword = '\:\s[a-z]{1,100}'
valid = 0
for x in passwordlist:
le... |
8298098da99e3995850181222281f4b4804b82b6 | bba2bb9a3d923c6497a85e1cc1eecb9b9e525e86 | huaweicloud/huaweicloud-sdk-python-v3 | /huaweicloud-sdk-eihealth/huaweicloudsdkeihealth/v1/model/show_notebook_request.py | Python | py | 4,391 | permissive | # coding: utf-8
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ShowNotebookRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribut... |
2babf9348dd88cb3168045e0aa62c2092e26eb9c | 579a8e30a821bdd44d021b3f8629ecaf46791e9f | Mudasirrr/Courses- | /MITx-6.00.1x/pset2/2.1 Paying Debt Off In a Year.py | Python | py | 390 | permissive | # -*- coding: utf-8 -*-
"""
@author: salimt
"""
balance = 42; annualInterestRate = 0.2; monthlyPaymentRate = 0.04
for month in range(12):
minimumPayment = balance * monthlyPaymentRate
unpaidBalance = balance - minimumPayment
interestRate = annualInterestRate/12 * unpaidBalance
balance = unpai... |
d3543efafdb89e28732466f74d9242ba6574dd90 | c14dd7be7d287bbc600bfc6e8dc4caf8209e78de | lorenzocerrone/moebius-game-of-life | /setup.py | Python | py | 403 | permissive | from setuptools import setup, find_packages
exec(open('plantseg/__version__.py').read())
setup(
name='moebiusgol',
version=__version__,
packages=find_packages(),
include_package_data=True,
description='moebius-game-of-life.',
author='Lorenzo Cerrone',
url='https://github.com/lorenzocerrone/... |
2f30edef5606d3806cd833a9f14b7a2edbc3670c | cf8fd5a0ac9ae5c55e3d5250558622d97b76032c | EDCBVUCOEP/blog | /blog/migrations/0005_auto_20180203_1418.py | Python | py | 418 | no_license | # Generated by Django 2.0.1 on 2018-02-03 14:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0004_postmodel_author_name'),
]
operations = [
migrations.AlterField(
model_name='postmodel',
name='author_n... |
311dc4401ffc720275b3d8ffb1ab46571091eccc | ae4a8dc26cb5b530acc9a33a68cf6b6358e71f46 | shrivastava-himanshu/Leetcode_practice | /venv/Lib/site-packages/com/vmware/nsx/systemhealth/plugins_client.py | Python | py | 4,856 | no_license | # -*- coding: utf-8 -*-
#---------------------------------------------------------------------------
# Copyright 2021 VMware, Inc. All rights reserved.
# AUTO GENERATED FILE -- DO NOT MODIFY!
#
# vAPI stub file for package com.vmware.nsx.systemhealth.plugins.
#---------------------------------------------------------... |
936b440046a319e92e9f9517d19b3f86c1a39b9a | 09a4fd89dbf2957fd992cd7eb642a7a3e943b6c3 | Harunosakura/diagnose-heart | /heart.py | Python | py | 13,210 | permissive | from diagnose_heart_log import dhl
import numpy as np
import dicom
import os
import re
from collections import Counter;
from PIL import Image,ImageDraw;
from skimage import exposure;
import config;
debug=False;
from scipy.misc import imrotate;
def getAlignImg(t,label = None):#!!!notice, only take uint8 type for the i... |
ed59b348501eb13079e4ae93c65c3c35cf6be2e7 | fd685652540993742c1891702c451790c8a6ab2b | mbszarek/django-task-app | /manage.py | Python | py | 540 | no_license | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "task_app.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are... |
e51f80e828bdea3822c9e612f1f3f3b00bc9bf4c | ae053b610945d93096406c3494e601095849c0ee | stoiver/anuga_core | /validation_tests/analytical_exact/carrier_greenspan_periodic/bisect_function.py | Python | py | 1,015 | permissive | ## module bisect
''' root = bisect(f,x1,x2,switch=0,tol=1.0e-9).
Finds a root of f(x) = 0 by bisection.
The root must be bracketed in (x1,x2).
Setting switch = 1 returns root = None if
f(x) increases as a result of a bisection.
Taken from the book Numerical Methods in Engineering with Py... |
c1d667a7bf8471e4d0a852eb2402704bbf9861a5 | 448671764eb7f1cdd19db3b1110e2b86412ec7c6 | vaduraes/OceanProject-2019-2020 | /Data_OceanCurrent/LCOEGeoPlot.py | Python | py | 3,970 | no_license | #Geo plot of the LCOE for ocean current energy
import numpy as np
import geopandas as gpd
import datetime as dt
import csv
import matplotlib.colors as clrs
import matplotlib.pyplot as plt
#Distance between two lat long points
def DistanceToShore (CoastLine, LatLong1): #Compute distance to shore in km of a lat long poi... |
40bbd7736efebcb61f59f4500a5b7830b4df31a7 | 35b798bfeedc27d273d4c37c78ea7bb69443db63 | hasegaw/zabbix-data-collectors | /zabbix/scripts/mdraid-discovery.py | Python | py | 2,092 | no_license | #! /usr/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) 2016 Takeshi HASEGAWA <hasegaw@gmail.com>
#
# 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 w... |
b75ee7db86bee26e6e773d370a29e39757450426 | bf2cce0debfdcd0a33466f0dcdb58e68de02b7be | rogersjeffreyl/SET_Project | /evaluator.py | Python | py | 7,689 | no_license | __author__ = 'rogersjeffrey'
"""
use to evaluate the runs on the test data
"""
import utils
import pprint
from collections import defaultdict
from xml.dom.minidom import parse, parseString
import cPickle as pickle
class evaluator:
def __init__(self):
self.train_sentence_model=pickle.load(open("models/t... |
19cf20664acc1cc3284a10930852c75cb03fa337 | 169708c8be49dfbbcdcfe619cb0568ed14f5bcfe | shiweifu/fanfoulib | /oauth.py | Python | py | 23,514 | no_license | """
The MIT License
Copyright (c) 2007 Leah Culver
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, merge, publis... |
5dace1d2d6bb682b21059c24bdcbc0caf515e697 | 4a26d7c54deb0ed7b37db91a3f676c2f2fe1b262 | shihuaxing/sina_crawler | /spider/yelp_spider_scrapy/food/settings.py | Python | py | 1,192 | no_license | # -*- coding: utf-8 -*-
# Scrapy settings for food project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/latest/to... |
62f43a92620b7df9d3fd66704cbe2dfb44c63387 | 8593c8567f9b8364885fc1053b7d09a53607f633 | AlbertJW/french-english_flash_cards | /main.py | Python | py | 2,753 | no_license | import tkinter as tk
import pandas as pd
import random
BACKGROUND_COLOR = "#B1DDC6"
INDEX = 0
WORD_LIST = {}
# import data
try:
data = pd.read_csv("data/words_to_learn.csv")
except FileNotFoundError:
original_data = pd.read_csv("data/french_words.csv")
WORD_LIST = original_data.to_dict(orient="records")... |
fee477bcd7e3a0ea4f146c8b049e0db476115b66 | 0b72f4810cd93fa1602e060ec9012aff3a3fefdd | xingfenhao/study | /pytest/Test.py | Python | py | 229 | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
for i in range(1,5):
for j in range(1,5):
for k in range(1,5):
if( i != k ) and (i != j) and (j != k):
print(i,j,k);
print(1111); |
2b49de7ec2352d103d5bb44032dbde0edd594667 | 4b659b8409060e8c89ee8b8b4c5a357dff758cdf | Biggig/AI | /Project/P02_CSP_KRR/FC.py | Python | py | 6,861 | no_license | def getVset():#初始化值域
vset = [[[i+1 for i in range(9)] for row in range(9)] for col in range(9)]
vset[0][3] = [7,]
vset[0][4] = [3,]
vset[0][5] = [8,]
vset[0][7] = [5,]
vset[1][2] = [7,]
vset[1][5] = [2,]
vset[2][5] = [9,]
vset[3][3] = [4,]
vset[4][2] = [1,]
vset[4]... |
a3859f5471bf47339a281023e2d64f22ffe78db8 | 77ca249e7356cbf8872f6c2dbd1c1fd9b5bd5077 | catchsattar/BeingMomin | /AmbassadorPortal/migrations/0002_auto_20190426_0556.py | Python | py | 531 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-26 05:56
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('AmbassadorPortal', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(... |
9eb6fb3a7467f607d9d05fbb040e76ee68949efd | 646e919d2b9b3db15cbe88b2cf635991c553c08d | iamdefinitelyahuman/curve-dao-contracts | /scripts/deployment/vest_other_tokens.py | Python | py | 4,305 | permissive | import json
from brownie import ERC20CRV, VestingEscrow, VestingEscrowFactory, VestingEscrowSimple, accounts
from . import deployment_config as config
ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"
YEAR = 86400 * 365
def live():
"""
Vest tokens in a live environment.
"""
admin, _ = con... |
cd5b8aefa3dd450676462cc54726b2f7ee3c6517 | 672404cb9c68ceb648de9b0cb9a63917a41621c8 | ray1422/gst-transformer-tts | /modules/attentions.py | Python | py | 9,625 | no_license | import tensorflow as tf
import numpy as np
'''
TF 2.0's basic attention layers(Attention and AdditiveAttention) calculate parallelly.
TO USE MONOTONIC FUNCTION, ATTENTION MUST KNOW 'n-1 ALIGNMENT'.
Thus, this parallel versions do not support the monotonic function.
'''
class BahdanauAttention(tf.keras.layers.Layer):... |
a441e9236278075e01f2ce2802fe5a6a376ea802 | 7496e6e2770eebd8f6610a337d5617b907eca558 | shengxia0111/FlaskProj | /venv/Scripts/easy_install-script.py | Python | py | 450 | no_license | #!E:\F\2018µÚһѧÆÚ\FlaskProj\venv\Scripts\python.exe -x
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==39.1.0','console_scripts','easy_install'
__requires__ = 'setuptools==39.1.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$',... |
d653d8c8efb0005a9d889b9e1d795cef6245acae | 6d26ce13a2521135f9269733ddd1fb158706e6e2 | perpohou/helloWorld | /renmengmeng(2018-5-24)/chat/start.py | Python | py | 2,330 | no_license | #coding=utf-8
import os
import tornado.ioloop
import tornado.web
import tornado.websocket
#WebSocket connection to 'ws://127.0.0.1:8181/websocket' failed: Error during WebSocket handshake: Unexpected response code: 403
#重写websocket中的check_origin方法,否则会出现以上403错误
#class WebSocketHandler(tornado.websocket.WebSocketHandl... |
3352c5a6c06a9533e903663079c9ec864bef730a | be586471b260b7a79a23346d90cc11b018bd4612 | brazil-data-cube/bdc-core | /bdc_core/decorators/utils.py | Python | py | 1,384 | permissive | #
# This file is part of BDC Core.
# Copyright (C) 2019-2020 INPE.
#
# BDC Core is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
"""Utility decorators for Brazil Data Cube Core app."""
import contextlib
import os
from bdc_core.utils... |
d6ff942d1edc9dd68376c51665f7607b807f64b7 | 84d3aa5db148469a71eadb096d60ebb345738401 | Antonio-Foglia/Voice_assistant | /__weather__.py | Python | py | 3,139 | no_license | import requests, json
from __output__ import say
from __input__ import inp
from __recognise__ import recognise
#from __ML__ import wml
import geocoder
def weather(text):
li=text.lower().split(' ')
if 'in' not in li:
#wml(li)
x=here()
info(x)
return
pos=li.index('in')
if ... |
e326cfae6bbbd857b61c974acfced4448914c347 | 77536ccb27a22fa7e6bb0fbb7d4f1e7c52517536 | sillsdev/crosswalk | /build/android/generate_version_code.py | Python | py | 1,894 | permissive | #!/usr/bin/env python
# Copyright (c) 2013 Intel Corporation. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Generates a value for the android:versionCode attribute in AndroidManifest.xml.
"""
import argparse
import sys
# This dictionar... |
6da489e0e0ed9e7a1b0294a589232d1488a99295 | 207f6f6f46c5e60dd7484a848b4b3d7c4789f203 | xangcastle/deltacopiers | /dtracking/admin.py | Python | py | 6,364 | no_license | from django.contrib import admin
from base.admin import entidad_admin
from grappelli.forms import GrappelliSortableHiddenMixin
from django.contrib.admin import widgets
from django import forms
from django.core.context_processors import csrf
from django.shortcuts import render_to_response
from django.http import HttpRes... |
74b7a74ad0111f6783e75996333bbb84821cde8d | b89bce705497cc56509f400558a9da5a53ae17fe | taochenlei/leetcode_algorithm | /108. Convert Sorted Array to Binary Search Tree.py | Python | py | 337 | no_license | class Solution:
def sortedArrayToBST(self, nums: List[int]) -> TreeNode:
if not nums:
return None
mid = len(nums) // 2
root = TreeNode(nums[mid])
root.left = self.sortedArrayToBST(nums[:mid])
root.right = self.sortedArrayToBST(nums[mid + 1:])
... |
ae4e06261a9a3220841ea7575e53a41b7fef35b3 | 77830b0ae62d1cf3a5b9b9b7e8233be8f376651d | mdugot/attention-based-text-recognition | /validation.py | Python | py | 1,529 | no_license | import os
import argparse
import numpy as np
import torch
from torch.utils.data import DataLoader
from matplotlib import pyplot as plt
from src.data import SynthTextDataset
from src.config import Config
from src.model import Model
from src.recorder import Recorder
from src.epoch import val_epoch
parser = argparse.A... |
a51f9d9cf0cad45fcfc207cc15f5091fb199f0c3 | bf187358462a4a7572a9d763ec98d4935e0efb31 | XLexxaX/AnyGraphMatcher | /cle/matcher/EmbeddingMatcher2.py | Python | py | 10,207 | no_license | import pandas as pd
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import classification_report
from sklearn.ensemble import RandomForestClassifier
from pandas_ml import ConfusionMatrix
from cle.configurations.PipelineTools import PipelineDataTuple
from cle.matcher import ... |
cbfd9873aab39fabef6460723e1fdef0ae0fb360 | 035e74f304f9308b00c411900820ee4736e9d2c2 | pktippa/python-docs | /numpy/num_py.py | Python | py | 3,791 | permissive | # All basic usage of numpy
import numpy as np
# prints the version of numpy
print(np.__version__)
# Whether element is a numpy array
el = np.array(list())
# Below command resolves to true
if isinstance(el, np.ndarray):
print("Element is a numpy array.")
array1 = np.array([1, 2, 3, 4])
# It performs element wise o... |
2f9e297f4de5966fb512faf8ce8a2934bbdabfc8 | 873481c667350bd4e4afc01fcdb44b88596a0227 | Harshalshree/Anton-Virtual-Assistant | /env/lib/python3.6/site-packages/AddressBook/__init__.py | Python | py | 817 | permissive | """
Python mapping for the AddressBook framework.
This module does not contain docstrings for the wrapped code, check Apple's
documentation for details on how to use these functions and classes.
"""
import objc
import sys
import Foundation
from AddressBook import _metadata
from AddressBook._AddressBook import *
try... |
b321fadece5d3c1aa2d0d4a8f00266ab9ac43e0b | e177577d3ee23b779c3d79f47beff459880bbf8e | Aie-Aie/socketproj | /index.py | Python | py | 2,323 | no_license |
from flask import Flask, jsonify, request
from database import DBconnection
from flask_httpauth import HTTPBasicAuth
from flask import render_template, redirect, url_for, session, flash
import sys, flask, os
import warnings
from flask.exthook import ExtDeprecationWarning
app = Flask (__name__)
auth = HTTPBasicAuth ()... |
4690ea0d861c4727c348bb54362982723ad42065 | 5e652c14b69360ea96ead4d5aeed4328958b9359 | RidaATariq/ITMD_413 | /Assignment-7/String_Module_YT/main.py | Python | py | 317 | no_license | # F-Strings - How to Use Them and Advanced String Formatting
first_name = 'Corey'
last_name = 'John'
# Without using F-string (I think)
# sentence = 'My name is {} {}'.format(first_name, last_name)
# print(sentence)
# Using F-String
sentence = f'My name is {first_name.upper()} {last_name.upper()}'
print(sentence) |
532787f72cf16b1526c0c009ca405cefbdc3653a | 59c2e76f2bec9d2fca4edbde3df6db4d968237dc | yukishinohara/projects | /machinelearning/rnntest02/trial17.py | Python | py | 1,839 | no_license | #!/usr/bin/env python
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
import h5py as h5
import os
import Rnn as Rn
import NeuralNetwork as Nn
def main(verbose=1):
fp = h5.File(os.path.join('.', 'testdata02.h5'), 'r')
x = fp['/train/data'].value
y = fp['/train/labe... |
156a2c6118d50719ec7d7599820d66912c20466b | c59207b811bccc9ededaf0ee6782bfd07f522ece | Ureimu/weather-robot | /python_code/vnev/Lib/site-packages/jdcloud_sdk/services/jmr/models/Disk.py | Python | py | 942 | permissive | # coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
b1af40ac70837372481936df4b253351777c0e34 | 3c13e48533041bbd4e4008970bec6f93bfbd333b | Som94/Python-repo | /Exception Handling on DB Connection/mysqltestcmd.py | Python | py | 325 | no_license | import mysql.connector
con=mysql.connector.connect(user='root',password='root',database='test',host='localhost',port=3306)
cursor=con.cursor()
try:
cursor.execute('create table test(id int)')
print("Created successfully")
except mysql.connector.errors.ProgrammingError:
print("Table Already Exists , Try another na... |
2bce25de024ec103320034654afa1a807141a3cd | 9615167e512f57c4cbac3bb1e0175fc119543aa8 | junhofa0/2DGameProgramming | /Drills/Drill-09/pause_state.py | Python | py | 929 | no_license | import game_framework
import main_state
import title_state
from pico2d import *
name = "PauseState"
image = None
count = 0
def enter():
global image
image = load_image('pause.png')
def exit():
global image
del(image)
def handle_events():
events = get_events()
for event in events:
... |
ae476c555efe788f94116a4600d553bb89ab5f17 | 6a84c9f88977302197a4951096ecccba6426a9f5 | Dantiteis/P50-G7-MinTIC2022 | /AplicacionCiclo3/serializers/userSerializers.py | Python | py | 1,268 | permissive | from rest_framework import serializers
from AplicacionCiclo3.models.user import User
from AplicacionCiclo3.models.account import Account
from AplicacionCiclo3.serializers.accountSerializers import AccountSerializer
class UserSerializers(serializers.ModelSerializer):
account = AccountSerializer()
class Meta:
... |
0921371b3a462f2c8200bbb3afdbbf5602d2458b | 486884969a5eca8ee84ca0aed9caa7cd98d99657 | ja-odur/python-concurrency | /4_asyncio/7_thread_safe.py | Python | py | 1,062 | no_license | import asyncio
from concurrent.futures import ThreadPoolExecutor
class Message(dict):
def __init__(self, **content):
super().__init__()
self.content = content
for k, v in content.items():
self[k] = v
def __repr__(self):
return f'Message(**{self.content})'
async d... |
45a917d5b88e244b794293823378ebdc5acf73be | 1a7f411a9373783b399aa3a15276db1d120949cd | emilyg406/UG-Summer-Research-2018 | /Coding_Exercises/LinearSolve-Iterative-3D.py | Python | py | 3,236 | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 10 07:59:29 2018
@author: allen
"""
#This code implement solves an equation Ax=b iteratively where A is 3x3.
#########################################################
#An iterative solver means that we first guess a solution
#Then proceed through a number of step... |
2946608c959a1c565dbc183239a3cc2b327c52c6 | f28896ad4da472ed2c8428a172d8cde5770e527f | IoannisChadjiminas/individual_project | /api/migrations/0006_post_emotion.py | Python | py | 442 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-25 22:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0005_auto_20160525_2208'),
]
operations = [
migrations.AddField(
... |
566fb63781ed347b71274470f7fc06739e68798e | 2e409e5f843766f20f612be6ef000c6c980437b4 | Winnie627/NLP-AGV-project | /awake.py | Python | py | 3,347 | no_license | # -*- coding: utf-8 -*-
import pyaudio
import numpy as np
from scipy import fftpack
import time
# import threading
import _thread
import wave
class Recorder():
def __init__(self, chunk=1024, channels=1, rate=64000):
self.CHUNK = chunk
self.FORMAT = pyaudio.paInt16 # 每次采集的位数
self.CHANNELS ... |
1ed8c5fdf0c1dc06f6ca66ff840b7b53b4bb0dd3 | afeae1c7cc8c9cd5272b9fdf615d61a08d52a9d8 | hunterthe100/RadiationTrackingSD | /src/dao/place_dao.py | Python | py | 645 | no_license | from typing import Dict, List
from src.clients.google_api_caller import GoogleAPICaller
from src.model.gps_location import GPSPoint
class PlacesDAO:
def __init__(self):
self.google_api_caller: GoogleAPICaller = GoogleAPICaller()
# Return a GPSPoint object of the most likely candidate matching the pl... |
2d3636239101d7ee4e6436f5847937ff1e7a580a | f8c83d80499d5077c7bfdd9cb9880912ba115771 | Doffery/LightNAS | /src/path_generator.py | Python | py | 40,772 | no_license | import utils
import os
import sys
import numpy as np
import tensorflow as tf
from src.models import Model
from src.image_ops import conv
from src.image_ops import fully_connected
from src.image_ops import batch_norm
from src.image_ops import batch_norm_with_mask
from src.image_ops import relu
from src.image_ops impo... |
dc2f6b10c89610dc3f66085633baf688a680f3ba | 676b90765fa9ffd9db1194271cd972746238ed40 | Cojabi/DataComp | /src/datacomp/stats.py | Python | py | 12,303 | permissive | # -*- coding: utf-8 -*-
import warnings
import numpy as np
import pandas as pd
from scipy.stats import mannwhitneyu, ttest_ind, chisquare, wilcoxon, fisher_exact
from statsmodels.multivariate.manova import MANOVA
from statsmodels.sandbox.stats.multicomp import multipletests
from .utils import construct_formula, _cat... |
eb3a545e540d734bf8788e3f547f09a3ef4eb2a1 | dfdb8d37e9531da0ecd9b59360d346fcc82b6440 | ricardosmotta/python_faculdade | /ap-ex3.py | Python | py | 1,640 | no_license | # Atividade Prática - Lógica de Programação e Algoritmos
# Análise e Desenvolvimento de Sistemas - UNINTER
# Autor: Ricardo Motta
# Data: 29/08/2021
# Exercício 3
# Faça um algoritmo que cadastre o nome de pessoas e um valor de doação. O programa deverá embaralhar a lista e sortear
# um ganhador imprimindo seu nome.
# ... |
89218316b681bf519d5e8ac509cdd1fb94d86cff | 434d0020c73d726ff7241ca2bc40f6b9d93e376e | rc-dining-bot/scraper | /src/queries.py | Python | py | 710 | no_license | breakfast_insert_query = "INSERT INTO breakfast (date, self_service, western, "\
"dim_sum_congee_noodle, asian, asian_vegetarian, malay, "\
"halal_vegetarian, grab_and_go)"\
"VALUES %s"
breakfast_insert_template = "(%(date)s, %(self_service)s, %(western)s, "\
"%(dim_sum_congee_noodle)s, %(asian)s, %(as... |
23d2c47ac4e07527c28bf2ffa8653bb19ff70039 | 64c0c4aae21cff0c23b6bcffa524c3d4516bfc46 | aychen99/Excavating-Occaneechi-Town | /tests/generate_new_site/utilities/test_str_ops.py | Python | py | 1,165 | permissive | from src.generate_new_site.utilities import str_ops
import pytest
################################
# page_num_to_arabic unit test #
################################
@pytest.mark.parametrize("roman,arabic", [
("i", "1"),
("iii", "3"),
("iv", "4"),
("v", "5"),
("vi", "6"),
("ix", "9"),
("x"... |
c30847ce2e336d3df65f1becc440e69cca23bfba | f2d840fe6fb29b998f7b685998b9d1eeaec1c7ce | franciscocalderon2/incubator-mxnet | /python/mxnet/contrib/onnx/mx2onnx/_op_translations.py | Python | py | 77,575 | permissive | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
acfdf9a478f49fc8846404de6f0d9ee4fd6faeb8 | a6f618e3d6b87540490c4abf52dcfdc45e57cfe0 | egomez3412/2-Player-Pong | /2pong.py | Python | py | 32,638 | no_license | import turtle
import time
import winsound
time_limit = 45
score_limit = 10
score_a = 0
score_b = 0
ball_speed_x = .4
ball_speed_y = .4
ifTwoBalls = False
ifThreeBalls = False
if_paused = False
running = True
game_state = "splash"
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
wn = turtle.Screen() # w... |
e12dc6baa44a6568a56f2cff2478a6fb5407e653 | 3bb4e1663cda0c28fd474df5c0a577ebc960c6ec | QD888/python-vplex | /vplexapi-6.2.0.3/vplexapi/api/director_ports_api.py | Python | py | 13,226 | permissive | # coding: utf-8
"""
VPlex REST API
A defnition for the next-gen VPlex API # noqa: E501
OpenAPI spec version: 0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
... |
14df2398730329f33b8c20d2f429e2b789a2bfe1 | 7c5dbf6ae95a2798835b84ec9416e7ef76a3ff42 | sunxingxingtf/form-data-augmentation | /affine_transform.py | Python | py | 5,818 | no_license | from pathlib import Path
import cv2
import numpy as np
from tqdm import tqdm
def displacement(
image: np.ndarray, horizontal_scale: float = 0.1, vertical_scale: float = 0.1
) -> np.ndarray:
"""
Displaces an image horzontally and vertically by respective scales
Args:
image (np.ndarray): BGR im... |
d2161d63056fcea5d4907176f82236219038aee6 | e8bc8e3e496e2b8de4b5755372a31cc431c6d5ac | alexgao66/myPython | /langLearning/hello_world.py | Python | py | 667 | no_license | print('------basic------')
print ('hello world!')
myStr = 'abc'
print(myStr)
a, b, c, d, e = 1, 'b', True, 3.14, 4+3j
print(type(a),type(b),type(c),type(d),type(e))
print('\n------number------')
print('2/4:',2/4)
print('2//4:',2//4)
print('2 ** 5:', 2 ** 5)
print('\n------str------')
s = 'Yes,he\'s'
print(s,type(s),l... |
b8f381aa2db8118cbd7b8899917dec267b76eafc | 4f8dcf0966a0943ef217e12affe175c779429e9b | luhc300/QuantumBigData | /feature/recruit/recruit_generate.py | Python | py | 467 | no_license | from feature.feature_generator import FeatureGenerator
from configs.path_config import DATA_PATH_HOME
from feature.recruit.recruit_count import RecruitCount
from feature.recruit.mean_recruit import MeanRecruit
def get_single():
fg = FeatureGenerator()
fg.set_action_list([RecruitCount(), MeanRecruit()])
re... |
2ee7217af832bd8d6cddc8106b1a629b95ccb6c7 | 367c5cd60df00f89a0f9e4c924e3be3622eb3d27 | ksinuk/python_open | /my_pychram/5 project/venv/Scripts/pip3.6-script.py | Python | py | 433 | no_license | #!"C:\Users\student\Desktop\python\my_pychram\5 project\venv\Scripts\python.exe"
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3.6'
__requires__ = 'pip==10.0.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)... |
8d9a52093c2120ef25e083a35e3a7354387cba2e | f2ecb1551935a326c09ba063b70d5c48a66725d4 | fagan2888/CS6190_project | /nn_param.py | Python | py | 30,991 | no_license | import pickle
import pandas as pd
import os, glob
import matplotlib.pyplot as plt
from scipy import optimize
import numpy as np
import tensorflow as tf
from sklearn.model_selection import train_test_split
import sklearn
from keras.models import Sequential
from keras.layers import Dense, Activation
def ge... |
f6e1e98ea55fbcdd21ce3a56c8a03ea0fc7c2481 | 391469fbbe9660492c93593c6e2479ce1442aad9 | IvanNMihaylov/Scrapy_Spider | /gplay/gplay/items.py | Python | py | 261 | no_license | # Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
class GplayItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
|
1511428717a06ff48aa0a522f61338a80ada09f3 | 9552193f32bff91d30fa3aad4a045ea4536f8d44 | s-christian/Schoolwork | /Data Structure and Algorithm Analysis/sorting/selection_sort.py | Python | py | 510 | no_license | def selection_sort(a):
for i in range(0, len(a)):
# find index of smallest element
min_index = i
for j in range(i + 1, len(a)):
if a[j] < a[min_index]:
min_index = j
# swap smallest element with a[i]
temp = a[i]
a[i] = a[min_index]... |
2a611bb81dfddd746db0943856d5852ad91667cd | 66da80cca8b1499c1efa9f8bde650ef5fbc7c99e | wasytb72/azure-quickstart-templates | /application-workloads/scrapy/scrapy-on-ubuntu/myspider.py | Python | py | 293 | permissive | from scrapy import Spider, Item, Field
class Post(Item):
title = Field()
class BlogSpider(Spider):
name, start_urls = 'blogspider', ['http://blog.scrapinghub.com']
def parse(self, response):
return [Post(title=e.extract()) for e in response.css("h2 a::text")]
|
6827c9917e904bd2d7b84ed0e7d236a7b3b6c83c | 117d1b2d92eb444d81a89e523eab46e63467479c | JeffLIrion/home-assistant | /homeassistant/components/http/auth.py | Python | py | 6,803 | permissive | """Authentication for HTTP component."""
from __future__ import annotations
from collections.abc import Awaitable, Callable
from datetime import timedelta
from ipaddress import ip_address
import logging
import secrets
from typing import Final
from urllib.parse import unquote
from aiohttp import hdrs
from aiohttp.web ... |
c1bb94c15616a8a64bc69a6055505a000824c8ae | 0634be188dbef6384e9f22c9d194bca09ac2b9ed | cpwaters/shappy | /shappy/pricelist/migrations/0007_product_store.py | Python | py | 401 | no_license | # Generated by Django 3.2.6 on 2021-09-02 12:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pricelist', '0006_product_pack_size'),
]
operations = [
migrations.AddField(
model_name='product',
name='store',
... |
913b82c9415c103ed376c65957fd13e45a6e47c6 | 7e2b3ef734a3ba937403821c9376a2b2acd637a2 | shivakrshn49/python-concepts | /ContextManagers.py | Python | py | 3,777 | no_license | """
1. Any Class that has __enter__, __exit__ methods defined is nothing but a Context Manager Class / Context Manager
2. with statement/identifier/keyword only works on instances of Context Manager Classes or functions
3. Context Manager Class are used to acquire and close the system resources efficiently like file op... |
2cb4404404767ddbb20702c4645786cde3e086d3 | 1d19a1dcf1f7216c6d7a6dcb5270ce207ebb3d84 | i-feofilaktov/allure-python | /allure-behave/features/steps/behave_steps.py | Python | py | 1,241 | permissive | import os
from tempfile import mkdtemp
from allure_testing.report import AllureReport
from behave.parser import Parser
from behave.runner import ModelRunner
from behave.configuration import Configuration
from behave.formatter._registry import make_formatters
from behave.formatter.base import StreamOpener
@given(u'fea... |
2c4d4a4f5c6afd01e4d4340cdcc99a1befa367f6 | 5f1e8619061a5c7eef4a054fbc6766fbc5c8c33a | sz2472/foundations-homework | /03/homework-3-zhao.py | Python | py | 1,681 | permissive | #Shengying Zhao
#May 31, 2016
#Homework 3
countries=['United States', 'China', 'Britain', 'France', 'Greece', 'Egypt', 'Japan']
for country in countries:
print(country)
countries.sort()
print(countries)
print(countries[0])
print(countries[-2])
countries.remove('Britain')
print(countries)
for country in countries:
... |
f898642c964cf03bb57ac1132ebabb05c018cc21 | de92362416e9b90de7d2ef4fcd1c98e38d4fe861 | Kingsleymuturi/Hood-connections | /hoodie/models.py | Python | py | 3,074 | permissive | from django.db import models
from django.contrib.auth.models import User
from pyuploadcare.dj.models import ImageField
from django.dispatch import receiver
from django.db.models.signals import post_save
from django.conf import settings
from rest_framework.authtoken.models import Token
class NeighbourHood(models.Model... |
3ddef7d649b072181beb2fb40adbebdc5c544598 | f3bbc4625469f88910d86a813e2321b8d699615d | gelos12/WhatTime | /authpage/backend.py | Python | py | 855 | no_license | from django.conf import settings
from django.contrib.auth.hashers import check_password
from .models import User
class SettingsBackend:
"""
Authenticate against the settings ADMIN_LOGIN and ADMIN_PASSWORD.
Use the login name and a hash of the password. For example:
ADMIN_LOGIN = 'admin'
ADMIN_PAS... |
b02024477313a1333fad1613e2a87ad9bde93088 | 89c53d957fa6175008caf8f5321fbf52f3beff21 | atengler/swagger-kqueen-python | /swagger_client/models/io_k8s_api_core_v1_rbd_volume_source.py | Python | py | 10,686 | no_license | # coding: utf-8
"""
Kubernetes Queen API
A simple API to interact with Kubernetes clusters
OpenAPI spec version: 0.8
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class IoK8sApiCoreV1RBDVolumeSource(object)... |
7d03821def70332f6ce00af96675ff5eaa1e4ed4 | 0d53514421b5a96a3aff7a9517be999f9de0a2af | gavin971/TasmanSeaMHW_201516 | /OMAPS_properties.py | Python | py | 24,780 | no_license | '''
Software which uses the MHW definition
of Hobday et al. (2015) applied to
select SST time series around the globe
'''
# Load required modules
import numpy as np
from scipy import io
from datetime import date
from netCDF4 import Dataset
from matplotlib import pyplot as plt
from matplotlib import dates as ... |
8354a53da175cc45bf56f64460ad928e674e2678 | a698bb1dfd91ea87baa3b59770f5dc6a53fea956 | mazzaAnt/StackGAN-v2 | /code/model.py | Python | py | 20,334 | permissive |
import torch
import torch.nn as nn
import torch.nn.parallel
from miscc.config import cfg
from torch.autograd import Variable
import torch.nn.functional as F
from torchvision import models
import torch.utils.model_zoo as model_zoo
# ############################## For Compute inception score ##########################... |
ab58c8fba0796efdb1d08aadab62f460c919a90b | 5790052dda3a47be5290c1d286957311d8d0c80b | jmaguire/missile | /missile.py | Python | py | 4,233 | no_license | import math
G = 6.67408e-11
MASS_E = 5.972e24
RADIUS_E = 6371000.0
SAMPLE_TO_PRINT = 10000
ATMOSPHERE = 100000.00
GOLDEN_RATIO = (math.sqrt(5) + 1) / 2
MACH_RATIO_SEA_LEVEL = 0.00291545
# MK21 stats
MK21_MASS = 270
MK21_RADIUS = .28
MK21_BC = 150000
MK21_CD = 0.005739795918367346
# Warhead defaults
MASS = MK21_MASS
R... |
fb7e41bbbe0675070c5bb3a7b909256766a65ebf | 2d7ba5f082302b94a7bdbe9698f4c5814639b080 | JJRYY/python-study | /quiz/exam2.py | Python | py | 406 | no_license | list_a = [[10, 20], [30, 40, 70, 110], [50, 60], [80, 90, 100]]
dict_a = {'k': {'a': 10, 'b': 20}, 'l': {'a': 10, 'b': 20, 'c': 40}, 'm': {'a': 10}}
for key in dict_a:
output = key + " -> "
for item in dict_a[key]:
output += "{} : {} ".format(item, dict_a[key][item])
print(output)
for a in list_a... |
ab36ba07aefc8dc13d2cb679522d59a5e71d6445 | 9be24eeee9198c7ebbd01de2daab2bcbbe0299a4 | maiadus/JupyterExercises | /.ipynb_checkpoints/ex19-checkpoint.py | Python | py | 1,394 | no_license | def cheese_and_crackers(cheese_count, boxes_of_crackers):
print ("You have %d cheeses!" % cheese_count)
print ("You have %d boxes of crackers!" % boxes_of_crackers )
print ("Man that's enough for a party!")
print ("Get a blanket.\n")
print ("We can just give the function numbers directly:")
cheese_and... |
d3c0133efebac0ff13b8baaa7a1513ca5f171ef2 | c785bb85001b8143f6b42cc7fbc2bd7b11717252 | benreynwar/rfgnocchi | /ettus/rfnoc/qa_noc_shell.py | Python | py | 3,888 | permissive | import os
import unittest
import logging
import random
import testfixtures
from pyvivado import project, signal
from rfgnocchi.ettus.rfnoc import noc_shell
from rfgnocchi import config, chdr
logger = logging.getLogger(__name__)
class TestNocShell(unittest.TestCase):
def test_one(self):
... |
a61a6f4553b58ef853f29da2b9b0c673c92699f8 | 4477957190338a7666e91d2c6a29b1f58ed02be3 | bwlang/galaxy | /lib/tool_shed/galaxy_install/dependency_display.py | Python | py | 42,335 | permissive | import json
import logging
import os
import threading
from galaxy import util
from tool_shed.galaxy_install.utility_containers import GalaxyUtilityContainerManager
from tool_shed.util import common_util
from tool_shed.util import container_util
from tool_shed.util import readme_util
from tool_shed.util import reposito... |
9f9ce5ab03142f02df7e3cb38752c5f5fcc76eb0 | 69a594c1be4743dddfff53c48b7658257afb8f9e | Assessor/Phytnon-Coursera | /time_diff.py | Python | py | 631 | no_license | '''
Даны два момента времени в пределах одних и тех же суток.
Для каждого момента указан час, минута и секунда. Известно, что второй момент времени наступил не раньше первого.
Определите сколько секунд прошло между двумя моментами времени.
'''
h1 = int(input())
m1 = int(input())
s1 = int(input())
h2 = int(input())
m2 =... |
8f8d7f45a613c1cb5fed2d5af0bb84f5e57b030b | ab29469413f7b5d0ce77d58a6ae40ccb389f8179 | cherrellescott-signalwire/signalwire | /python/mms.py | Python | py | 373 | no_license | #!/usr/bin/python3
from signalwire.rest import Client as signalwire_client
client = signalwire_client("YOU_PROJECT_ID", "YOU_PROJECT_ID", signalwire_space_url = 'joshebosh.signalwire.com')
message = client.messages.create(
from_='+13342120123',
body='this is a test',
to='+19312989898',
media_url=['http://1co.joshebo... |
057be0159f1ece4502acf04f05d8ac214bb999a3 | e6ab76c803405aa3dd35be432f430bad35f8cdf0 | mrcrgl/django_distributed_task | /distributed_task/core/serializer.py | Python | py | 3,270 | permissive | from __future__ import unicode_literals
from django.core import serializers
from django.core.serializers.python import Deserializer
from django.db.models import Model
import datetime
import decimal
import json
from uuid import uuid4
from django.utils.timezone import is_aware
# Workaround for python3
try:
iterite... |
7435f43674a25af87c7d1c6511fab8baf114ebd4 | 38ff9659b3bc946c7b4a4e9777cfb3289d4a0a06 | Juanezm/s3-uploader | /tests/unit/test_operations.py | Python | py | 1,775 | no_license | from pathlib import Path
import boto3
from moto import mock_s3
from s3uploader.domain.operations import generate_object_name, check_dat_files_in_dir, \
delete_uploaded_dat_files_from_disk, upload_file_to_s3, delete_empty_folders_in_dir
import random
@mock_s3
def test_upload_file_to_s3(test_file):
bucket = 't... |
d88dfed3cc6c6da1003daa94db647b8ff39d779c | dca7cb53159ecb6d6541773123de37a493da5c13 | cyobero/myapp | /posts/models.py | Python | py | 603 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Posts(models.Model):
title = models.CharField(max_length=50)
caption = models.CharField(max_length=140)
body = models.TextField()
au... |
e78bf7dad0817a06a53a5f640d21352cc978114b | 4e801a987dc3076bfe632709050880862f7b2c6f | Guimili/RandomScraping | /redditbot/redditbot/middlewares.py | Python | py | 3,603 | no_license | # -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class RedditbotSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scrap... |
a6f8452b97695675b4736fac43cfb8258cb9a68f | 590f9158a39c15d24e6405818bef62976d344012 | zhlthunder/python-study | /python 语法基础/d14_tkinter_python图形开发界面库/tkinter/21.树状数据.py | Python | py | 1,239 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#author:zhl
import tkinter
from tkinter import ttk
win=tkinter.Tk()
win.title("zhl")
win.geometry("400x400+200+0")
tree=ttk.Treeview(win)
tree.pack()
##添加一级树枝
treeF1=tree.insert("",0,"中国",text="china",values=("F1"))
treeF2=tree.insert("",1,"美国",text="USA",values=("F2... |
38bc64f330ebcf63a925ffda289b6342d11b07be | 5a979fc9e4c229002bd2bb2df422e0771094e4a8 | Julian/pudb | /pudb/__init__.py | Python | py | 7,057 | permissive | NUM_VERSION = (2013, 5, 1)
VERSION = ".".join(str(nv) for nv in NUM_VERSION)
__version__ = VERSION
from pudb.py3compat import raw_input, PY3
from pudb.settings import load_config, save_config
CONFIG = load_config()
save_config(CONFIG)
class PudbShortcuts(object):
@property
def db(self):
import sys
... |
85eeaac67e6ff66cace7cbb91e218a4341ca93ae | 36c918232205d0e44586a8c9b077088362551afe | ajk12345-code/home-assistant | /tests/components/zwave/test_init.py | Python | py | 63,445 | permissive | """Tests for the Z-Wave init."""
import asyncio
from collections import OrderedDict
from datetime import datetime
import unittest
from unittest.mock import MagicMock, patch
import pytest
from pytz import utc
import voluptuous as vol
from homeassistant.bootstrap import async_setup_component
from homeassistant.componen... |
9e110ba3fe68abbc8680b1c10d530e8873f382f8 | f37de903d763e7add2455091940cbe044901d6eb | al3xrz/mini-rmis | /main/models.py | Python | py | 2,282 | no_license | from django.db import models
from med.models import *
from geo.models import Locality
st_CHOICES = (
( 'Круглосуточный' , 'Круглосуточный'),
( 'Дневной', 'Дневной'),
)
class Treatment(models.Model):
class Meta:
verbose_name = 'Лечение'
verbose_name_plural = 'Лечение'
st_type... |
ba1a975ab7bf37de4d5050b16afd54a4d108cb4f | 6e7e240e2b2e33b93f90a45cb61cb470301915e7 | scipsycho/indy-plenum | /plenum/recorder/replayable_node.py | Python | py | 5,782 | permissive | import os
import shutil
from typing import Dict, List
from plenum.common.config_helper import PConfigHelper
from plenum.common.exceptions import InvalidClientMessageException, UnknownIdentifier
from plenum.common.messages.node_messages import Reject
from plenum.common.util import get_utc_epoch
def create_replayable... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.