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 |
|---|---|---|---|---|---|---|---|---|
f241d573d9db81c2977bdcf77a05e5cc77d12c92 | f90ed6e4a15daeaeb599bfeb218892d5b1761e9b | brittCommit/code_challenges | /find_occurence.py | Python | py | 883 | no_license | def findOcurrences(text, first, second):
"""
Given words first and second, consider occurrences in some text of the form
"first second third", where second comes immediately after first, and third
comes immediately after second.
For each such occurrence, add "third" to the answer, and return the a... |
06391cb5d9a8e589299203cdf649a29ed95aa083 | c904866787daff1c9a3ff8e97f34decebd3072e9 | textmagic/textmagic-rest-python-v2 | /TextMagic/models/message_out.py | Python | py | 18,462 | permissive | # coding: utf-8
"""
TextMagic API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
... |
2e4cff746dcd7700c75e9402d6ccd24843640cfc | 013148e2fd0b709216b89255b7dd9d6499bab36d | CarlosDinart/PUC-SP | /Aula 4 Semana - POO - Encapsulamento.py | Python | py | 1,590 | no_license | # Encapsulamento - objetivo e esconder parte do seu codigo para proteger acesso do seu codigo
#metodos: public, protected (_ ANTES DO ATRIBUTO OU METODOS),
# private (__ ANTES DO ATRIBUTO OU METODOS);
# Estes metodos nao foram aderido pela linguagem python, para utliza los foi criados metodos de
# convencoes determna... |
6c90820252008bacbc1680c7efa8c105e198290f | afaf5f39b2ce3d0078ec6ee1165a7a759a81269b | kyaaqba/magma | /symphony/cli/pyinventory/graphql/input/survey_template_question.py | Python | py | 686 | permissive | #!/usr/bin/env python3
# @generated AUTOGENERATED file. Do not Change!
from dataclasses import dataclass
from datetime import datetime
from functools import partial
from gql.gql.datetime_utils import DATETIME_FIELD
from numbers import Number
from typing import Any, Callable, List, Mapping, Optional
from dataclasses_j... |
1e074eba063a9bcabee98e8c788cfb698f14e404 | 6fb9459e0f7456f56d592e5b31cf592a298b0d37 | dldmsdndb/bookmark | /bookmark/bookmark/views.py | Python | py | 890 | no_license | from django.shortcuts import render
# models
from .models import Bookmark
# urls
from django.urls import reverse_lazy
# views
from django.views.generic.list import ListView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.views.generic.detail import DetailView
# Create your views ... |
728ef54926a894f4baa43de594aefd6bcea2f836 | 9284c535d54d9ccc38669362eb820ba0601f8fd7 | jamescooke/flake8-aaa | /tests/visitors/test_find_first_child_nodes.py | Python | py | 1,127 | permissive | import pytest
from flake8_aaa.visitors import find_first_child_nodes
@pytest.mark.parametrize(
'code_str', [
'''
def test():
with mock.patch('things.thinger'):
with pytest.raises(ValueError):
things()
'''
]
)
def test(first_node_with_tokens) -> None:
with_mock_node = first... |
955d7bb0a5b9ab7c09fde68eefccfed07358476b | 16b286227ece4ef10a00df1db8ce6193180c7774 | OtacilioN/cesar-school-fp-lista-de-exercicios-03-OtacilioN | /questoes/questao_3.py | Python | py | 2,394 | no_license | ## QUESTÃO 3 ##
#
# Um robô se move em um plano a partir do ponto original (0,0). O robô pode se
# mover nas direções CIMA, BAIXO, ESQUERDA e DIREITA de acordo com um
# passo fornecido. O traço do movimento do robô é mostrado da seguinte forma:
#
# CIMA 5
# BAIXO 3
# ESQUERDA 3
# DIREITA 2
#
# Os números após a direç... |
ee8f44df0e3a8326649b65e28632be2e0c3d886d | 95901f3b2151a58deb5b9b675874171dab4fdd03 | unicef/etools-datamart | /tests/multitenant/test_schema_selection.py | Python | py | 4,177 | no_license | from django.db import connections
from django.urls import reverse
import pytest
from etools_datamart.apps.multitenant.exceptions import InvalidSchema
conn = connections["etools"]
@pytest.fixture()
def url():
return reverse("admin:etools_partnerspartnerorganization_changelist")
# def test_cookie(django_app, a... |
30711d001b82776c0080e6e20bc5509abcec774e | dc307718c154116706a0482b7aa968473a307880 | David-zaiwang/RGBD_segmentation | /src/datasets/nyuv2/pytorch_dataset.py | Python | py | 4,673 | permissive | # -*- coding: utf-8 -*-
"""
.. codeauthor:: Daniel Seichter <daniel.seichter@tu-ilmenau.de>
"""
import os
import cv2
import numpy as np
from ..dataset_base import DatasetBase
from .nyuv2 import NYUv2Base
class NYUv2(NYUv2Base, DatasetBase):
def __init__(self,
data_dir=None,
n_c... |
d1723ae4b6d511bdad9986df2ac12cfe20cde409 | 1b6bc1695b3fe8e22e74b5c374de76920aa72722 | mgax/iptables-clean-save | /tests.py | Python | py | 1,470 | no_license | from iptables_clean_save import clean
def test_remove_comments():
rulestext = ("# comment one\n"
" # comment two\n"
"some stuff here\n")
assert clean(rulestext) == "some stuff here\n"
def test_remove_counters():
rulestext = ":FORWARD ACCEPT [100:200]\n"
assert cle... |
2f0549dd7990fe5effd46491ce678663aff19f67 | 12555177bbcc92c404deb9beb2205fbf5187d7a9 | AaronM18/e-commerce-test | /storebackend/product/models.py | Python | py | 1,725 | no_license | from io import BytesIO
from PIL import Image
from django.core.files import File
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=255)
slug = models.SlugField()
class Meta:
ordering = ('name',)
def __str__(self):
return self.name
def get_absolute_url(s... |
1c7a51049898dcafce1de7aaa7c9cb4695461097 | 0028565df867b4f887b01a3413dd04d777a818c9 | dfalessi/CCP-changes | /metrics/files.py | Python | py | 5,031 | no_license | # -*- coding: utf-8 -*-
# http://www.grantjenks.com/docs/sortedcontainers/
# https://github.com/gitpython-developers/GitPython
import curloc
reload(curloc)
import itertools
import sys
import time
from git import *
#from sortedcontainers import SortedList, SortedDict, SortedSet
class Files:
def __init__(self,... |
28c73db1baff34967c868f425630e5ecbe3f89bf | 9f4f0aacbc9c7c1b52b9e754597e8939696f7318 | WebDevPE/webdevHackaton | /webdevprj/manage.py | Python | py | 665 | 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', 'webdevprj.settings')
try:
from django.core.management import execute_from_command_line
except Im... |
7a1073994bc386a63da4edf670fcac80262f1cfe | 75724a85e36f1985f96198f61c04456e98c48723 | imhardikj/git_test | /52_keys().py | Python | py | 507 | no_license | favorite_languages = { 'jen': 'python', 'sarah': 'c',
'edward': 'ruby', 'phil': 'python',}
friends = ['phil', 'edward']
for name in favorite_languages.keys(): # No need to use keys()
print(name.title()) # because its default behaviour when looping throug... |
cfce26204f6773675f90726eb3682470782c1daf | 82d214e53fa713e5c949b03ec663b4edf5efea68 | Covidou/Projet-Python | /django_project/commerce/migrations/0002_order.py | Python | py | 864 | no_license | # Generated by Django 3.0.6 on 2020-05-09 08:58
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('commerce', '0001_initial... |
ab0adf3685c1453f7a5ae6a14b5ed11e2fb90488 | 9e284969d037fae5666013ea0696a77a385f8652 | feng1918/qfeng | /python/test.py | Python | py | 1,018 | permissive |
from zipline.api import order_target, record, symbol
def initialize(context):
context.i = 0
context.asset = symbol('AAPL')
def handle_data(context, data):
# Skip first 300 days to get full windows
context.i += 1
if context.i < 300:
return
# Compute averages
# data.history() has... |
4bd3b8ec8f1bc8b87f9ef544d0a5f83b9922b7e0 | d5b482cebf41f3dbb15aaab760d9ef1bbb0ba49d | j-p-e-g/20questions | /scripts/pyGameMessageHistoryGUI.py | Python | py | 1,135 | no_license | from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from pyGameGlobals import *
import pyGameScrollBarGUI as scrollBar
# scrollable window capable of showing the message history
class MessageHistoryWindow(QTabWidget):
def __init__(self, _mainWindow):
super().__init__()
... |
796680a416952c4cfa6295a5f353256228fa24ed | 1d4505a8fa9846d34b7e93235a450236e4f455c2 | DamMroz/Angle | /Angle.py | Python | py | 17,010 | permissive | import numpy as np
from numpy import linalg as LA
from numpy.linalg import inv
from numpy import dot, arccos, clip
from numpy.linalg import norm
import math
class AngleClass:
def __init__(self, aex, bexa, cex, alphaex, betaex, gammaex, ath, btha, cth, alphath, betath, gammath,
filenam... |
43c2ccc8fff4f20018aeadddca8ab157bfe66c2e | cc45932bf954d11d0a7384429afb54f4067e4d25 | songyongzhuang/PythonCode_office | /lemon/python_wed/lemon_11_191206/TestDatas/login_datas.py | Python | py | 708 | no_license |
# !/usr/bin/python3
"""
@File : login_datas.py
@Time : 2019/12/2 21:41
@Author : 柠檬班-小简
@Email : lemonban_simple@qq.com
@Company: 湖南省零檬信息技术有限公司
"""
from lemon_09_191202_PO_02.TestDatas.Common_Datas import home_url
# 成功用例 - 数据
success_data = {"user": "18684720553", "passwd": "python", "check_url": home_url}
... |
971437d630606554f0883a459b222c41ffd4356d | 48dad28cd2b6e2eb81d9c36fb55ba8b4b1259f4f | meirwah/st2 | /contrib/packs/actions/pack_mgmt/unload.py | Python | py | 3,128 | permissive | # Licensed to the StackStorm, Inc ('StackStorm') 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 use th... |
d59947a6a313c2e12f8e64dd1f261d3c1b39d108 | 63534ee9b92c1e455a9e7e8b26435f65365f45b5 | yosukesuzuki/url-shortner | /appengine_config.py | Python | py | 918 | permissive | # Copyright 2016 Google 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 required by applicable law or agreed to in writing, ... |
6488e1fd5ec9ab02e309bf8f4c20b465dc0d1ea6 | 93a9453fa03fc952b85523e11c64c14a73b5003a | artzers/Python-Tools | /DeleteRepeatFiles.py | Python | py | 2,452 | permissive | # -*- coding:gb2312 -*-
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
import os, hashlib,shutil,codecs
import numpy as np
from collections import defaultdict
from collections import OrderedDict
def VisitDir(arg,dirname,names):
for filespath in names:
name = os.path.join(dirname,files... |
abddcb8718c45d776ef951d809cb1a038f49ae9c | 268c07591ab0622655ea83cf9300ee789d36d584 | iancballard/rule_bias | /monitors.py | Python | py | 702 | no_license | """Hold information about different monitors."""
from textwrap import dedent
bic = dict(name='BIC',
width=24,
distance=61,
size=[1024, 768],
framerate = 60,
notes=dedent('''BIC scanner. Width measured by measuring projected image
in s... |
429f2863e1077b004393667294f0ee4aec1c6630 | e55964c4282f68723999bd5f7965e8b0b75ab7d5 | mkocabas/soccerontable | /soccer3d/soccerdepth/data/dataset_loader.py | Python | py | 2,505 | permissive | from os import listdir
from os.path import join
import numpy as np
import torch.utils.data as data
# from scipy.misc import imread
from skimage.io import imread
def get_set(train_dir, nbins=-1, transform=None, additional_input_type='estmask'):
return DatasetFromFolder(train_dir, bins=nbins, transform=transform, ad... |
0d15431dd599afdc008c880e334ba6f7710e8271 | 31e64c2b546437b175d89127a38128abae60b492 | lurroque/poo | /pessoa.py | Python | py | 246 | no_license | class Pessoa:
def __init__(self, nome):
self.__nome = nome
@property
def nome(self):
return self.__nome
@nome.setter
def nome(self, nome):
print("Chamando property setter")
self.__nome = nome |
ce63a5000988619ede53a68defdc78e365dd6377 | cfbf1b86b13c341c6178d5f40d3082bc33807cd7 | leishu/tf-study | /back_propagation_classification.py | Python | py | 2,036 | no_license | import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from tensorflow.python.framework import ops
graph = tf.Graph()
# 我们将增加下列样本数据:
# x-data: 50个随机样本,服从正态分布 ~ N(-1, 1).50个随机样本,服从正态分布 ~ N(3, 1)
# target: 50个等于0的值,50个等于1的值
# 我们将符合二元分类模型:sigmoid(x+A) < 0.5 -> 0 else 1
# 理论上,A应该是 -(mean1 + mean2)/2
... |
dae33768a11bb041cf6b869da05ef9e8fbf7c135 | 605f60443867ad1192d0f35064c4653bc1dde567 | maksbotan/python-lastfm | /lastfm/util/wormhole.py | Python | py | 2,549 | no_license | #!/usr/bin/env python
__author__ = "Abhinav Sarkar <abhinav@abhinavsarkar.net>"
__version__ = "0.2"
__license__ = "GNU Lesser General Public License"
__package__ = "lastfm.util"
from collections import defaultdict
from lastfm.decorators import decorator
from threading import Lock
_lock = Lock()
class Wormhole(objec... |
99fcd213b14e0e73ac9a23c4548074915ee4567d | 57136fcb2e0e7f86fb6cd03cfb8fc158bf9bbce0 | Zhang-Henry/chess | /gameplays/human_play.py | Python | py | 3,912 | no_license | import sys
sys.path.append('..')
import argparse
import os
from net import resnet
import common
import numpy as np
import random
import time
import uuid
import asyncio
from config import conf
import tensorflow as tf
from aiohttp import web
import gameplay
import players
currentpath = os.path.dirname(os.path.realpath(_... |
bff00f0fd92495892639f14f1eef7b22effe8f55 | af147bea3ff94c7e6916d58ea3976519e33005f2 | mdubouch/noise-gan | /networks328.py | Python | py | 5,516 | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
__version__ = 205
# Number of wires in the CDC
n_wires = 3606
# Number of continuous features (E, t, dca)
n_features = 3
class Gen(nn.Module):
def __init__(self, ngf, latent_dims, seq_len, encoded_dim):
super().__init__... |
a03fc2cd66303e0b85a4f04b120d69fd7cfc8c82 | bf4dc62a470db3bcef93427d5ba83febc3460759 | yoelfme/PracticePython | /chapter4/chapter4_exercises.py | Python | py | 3,780 | no_license | #!/usr/bin/env python
'''
Using a series of if ... : statements, evaluate whether the numbers
from 0 through 4 are True or False by creating five separate tests
'''
if 0 is True:
print("0 is True")
if 1 is True:
print("1 is True")
if 2 is True:
print("2 is True")
if 3 is True:
print("3 is True")
if ... |
f0ced18fa5c091f3d9b90c18438a4969693c80ce | 0f2947069be7bfd8f7adc79405ad282989af7a84 | sanstwy777/Django-3-by-Example | /bookmarks/src/images/migrations/0002_image_total_likes.py | Python | py | 398 | no_license | # Generated by Django 3.0.2 on 2020-01-31 08:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('images', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='image',
name='total_likes',
... |
26a6557d624474b48dd28abf4c2df9ef2a1cb8a3 | 8b94588c497b16cb3287fe3e12ca715ceb42458c | fursuli/test_case-devs-n-props | /api_devs_n_props/views.py | Python | py | 959 | no_license | from django.shortcuts import render
# Create your views here.
from rest_framework import generics
from rest_framework.permissions import AllowAny
from api_devs_n_props.models import Device, Property
from api_devs_n_props.serializers import DeviceSerializer, PropertySerializer
class AllDevices(generics.RetrieveUpdat... |
45b43bad936ab588748fa16280d1c1b44fb9c208 | 22f0db4b489944729f24bf0c918970bde5bc5c47 | bobobo-prog/Kakushin | /simple_site/settings.py | Python | py | 3,338 | no_license | """
Django settings for simple_site project.
Generated by 'django-admin startproject' using Django 2.1.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
... |
9d3b53fecfbf89d3e35af8408e17675b673e915c | ee7c118747f515ef44bc0970b203ab5a98618d34 | seallard/walker | /experiments/maze/maze_environment.py | Python | py | 10,988 | permissive | #
# This is a definition of a maze environment simulation engine. It provides
# routines to read maze configuration and build related simulation environment
# from it. Also it provides method to simulate the behavior of the navigating agent
# and interaction with his sensors.
#
import math
import numpy as np
import o... |
5c7f8e3a2a2de1e857bb856b10f18507ac3dcd67 | 4e688302fe66a85a4c261b284d759180cd5aa386 | agrawal-prateek/codecata-hunter | /pro/pro_62.py | Python | py | 723 | no_license | def pro_62():
st = input()
n = len(st)
table = [[0 for i in range(n)] for j in range(n)]
max = 1
i = 0
while (i < n - 1):
table[i][i] = True
i += 1
start = 0
i = 0
while (i < n - 1):
if st[i] == st[i + 1]:
max = 2
start = i
... |
6a9ed9881e819cffdb15fbce1c3ad43af372f940 | 08ac64042d969e1a6d223ba09433896ed5fb1609 | SantoshKumarSingh64/December-2020-LeetCode-Monthly-Challenge | /D26_DecodeWays.py | Python | py | 1,907 | no_license | '''
Question Description :-
Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping:
'A' -> 1
'B' -> 2
...
'Z' -> 26
Given a non-empty string containing only digits, determine the total number of ways to decode it.
The answer is guaranteed to ... |
581604bd9302225245268c1d8cbf64cc60bc3762 | 3c27636ee737b9592170a39d977cfe39bf15d179 | ranka47/permission_portal | /IITGPermission/IITGPermission/settings.py | Python | py | 2,270 | no_license | """
Django settings for IITGPermission project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ... |
8a30e01e9713b86c36afb66fdb4d78917b28b14c | 0e7e4a6a86160666d16c5d9057b025b33dc0e8dc | KATO-Hiro/Somen-Soupy | /snippets/graph/scc.py | Python | py | 3,472 | permissive | # -*- coding: utf-8 -*-
"""
Usage:
n, m = map(int, input().split())
scc = SCCGraph(n)
for _ in range(m):
ai, bi = map(int, input().split())
ai -= 1
bi -= 1
scc.add_edge(ai, bi)
groups = scc.scc()
"""
import sys
import typing
# See:
# https://github.co... |
0b2a67938440caef6e8cba133e33181bef865ab8 | 2adaebcb50eed7f635b00d44f6e450dd0870c29c | cy22268/hello_world | /02day.py | Python | py | 4,707 | no_license | # 定义变量,并使用print函数打印出来
my_name = '刘德华'
print(my_name)
'''
整数运算
'''
# 加法
add = 3 + 4
print('3+4的值是{}'.format(add))
# 减法
sub = 10 - 8
print('10-8的值是{}'.format(sub))
# 乘法
multi = 23 * 3
print('23*3的值是{}'.format(multi))
# 除法
div = 10 / 2
print('10/2的值是{}'.format(div))
# 取模,返回除法的余数
delivery = 7 ... |
366b35551b0a7fdd6e4147f1d2fbff90ac9e7d41 | 3a1386d9be64a47cc26efc9b14b5200e41db2132 | waynemo/python-unit-testing | /tests/packagec/test_functiondependency.py | Python | py | 1,235 | no_license | import unittest
from mock import patch
import packagec.functiondependency as functiondependency
# Examples of mocking by patching
class TestFunctionDependency(unittest.TestCase):
@patch('packagec.functiondependency.samplefunction_module')
def test_uppercase_stubbed_function(self, samplefunctionmodulemock):
... |
ff64681ead0b6856efc50e26b7a7178c9772c867 | 58f886f98c86f2c2af0d95402bbd9e1079a5296c | webclinic017/fa-absa-py3 | /Extensions/SpanOrderValidationProducer/FPythonCode/FOrderValidationProducerBase.py | Python | py | 2,297 | no_license | """ Compiled: 2015-09-23 14:33:50 """
import FPaceProducer
import FOrderValidationCalculation
import acm
import traceback
class FOrderValidationProducerBase(FPaceProducer.Producer):
def __init__(self):
super(FOrderValidationProducerBase, self).__init__()
self._space = FOrderValidationCalculation.... |
cc4d8fc12eed28c464c6154635e5e6315039680b | c3b65bd96bde5b3da35de7054e1fc23e7f2e3707 | SS-V84/start_v3.py | /color4.py | Python | py | 3,997 | no_license | import pyautogui as pg
import time
import numpy as np
from PIL import Image
import cv2
def start(myimg):
# while True:
# # img_name = input(" What is the name of the picture greenhouse? ")
# img_name=pg.prompt( "What is the name of the picture greenhouse?", "Test")
#среднее значение пикселя картинки
... |
defb800e5edfbe9af8f3820faa551687972fefe2 | bf55cd9a2fdaf85f35326fe4b5f5ebecd0d466a1 | roundup-tracker/roundup | /roundup/dist/command/build_doc.py | Python | py | 1,714 | permissive | #
# Copyright (C) 2009 Stefan Seefeld
# All rights reserved.
# For license terms see the file COPYING.txt.
#
import os, sys
import os.path
try:
from setuptools.command.install import install as _build_py
except ImportError:
from distutils.command.build import build as _build_py # try/except clause
orig_b... |
cfc067c724da9a0890c81edd28c97f67263b376c | ea4b59edd32574fa8cd404b373c47a05df6f4ced | ShizukuIchi/CNApp | /cna_up/views.py | Python | py | 668 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.http import HttpResponse
import uploader
def index(request):
return render(request, 'cna_up/index.html')
def login(request):
username = str(request.POST.get("username", ""))
password = str(reque... |
91883c1fd8e9b2b35112cbd402f26563192e7eda | d262346b22ceee5c9d7552a704fb8872e755df07 | Praveen91299/Quantum-Internet | /_3_The_Network_Layer/repeater_chain.py | Python | py | 2,286 | no_license | import sys
sys.path.append("..")
from _4_The_Link_Layer.repeater import Repeater
from _4_The_Link_Layer.cable import Cable
# import globalState
class RepeaterChain(object):
def __init__(self, length):
self.length = length
self.repeaters = [Repeater(self) for i in range(length)]
# self.conn... |
754d42b387f71a18fc87132e06b3d2ba5c0882a1 | b9ed2bb4ac9ecb0bf9561453ceb001e1daf0c595 | DuaNoDo/PythonProject | /venv/Lib/site-packages/asn1crypto/algos.py | Python | py | 34,095 | no_license | # coding: utf-8
"""
ASN.1 type classes for various algorithms using in various aspects of public
key cryptography. Exports the following items:
- AlgorithmIdentifier()
- AnyAlgorithmIdentifier()
- DigestAlgorithm()
- DigestInfo()
- DSASignature()
- EncryptionAlgorithm()
- HmacAlgorithm()
- KdfAlgorithm()
- P... |
01c78d121c3553b4260cdee404a8bf3160939e24 | 3c077d26baf62a94bbb43f8457e6082fd554b541 | Jinjing98/keypoints_comparision | /testH.py | Python | py | 853 | no_license | import cv2
import numpy as np
from math import cos,sin
path = "E:\Datasets\surgical\ori_imgs\\4_5.png"
img = cv2.imread(path)
rows,cols,ch = img.shape
pts1 = np.float32([[50,50],[200,50],[50,200],[50,20]])
pts2 = np.float32([[10,100],[200,50],[100,250],[50,80]])
# M1 = cv2.getAffineTransform(pts1,pts2) # 3 pairs
M2 =... |
33b4c2cf19abc23479fdd2a1e985c836e3611b0e | c0a682bc94dc3c37645871663e9e648579ec44d5 | Azure-Samples/azure-intelligent-edge-patterns | /footfall-analysis/footfall-camera-solution/modules/footfall-inference-module/iotccsdk/ipcprovider.py | Python | py | 11,506 | permissive | # Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of c... |
3dc01739dc7ec6d5068d4b2c6cbc5a06e7aa0289 | 313a5a9431b33a9860e14455921a0fd870d338e9 | TiffanySantos/LearnPython3theHardWay | /ex38.py | Python | py | 592 | no_license | ten_things = "Apples Oranges Crows Telephone Light Sugar"
print("Wait, there are not ten things in that list. Let's fix that.")
stuff = ten_things.split(' ')
more_stuff = ["Day", "Night","Song", "Frisbee", "Corn", "Banana", "Girl", "Boy"]
while len(stuff) != 10:
next_one = more_stuff.pop()
print("Adding: ", ... |
c53b8fcb925e6f026c9c56a9a9af4e560498a995 | 89a007f3f0e2550250677886fb4063322b5c5e44 | mcwiseman97/Programming-Building-Blocks | /MealPriceCalculator.py | Python | py | 531 | no_license | child_meal = int(input(" What is the price of a child's meal? "))
adult_meal = int(input("What is the price of an adult's name? "))
num_child = int(input("How many children are there? "))
num_adult = int(input("How many adults are there? "))
tax_rate = int(input("What is the sales tax rate? "))
total = ((adult_meal * n... |
9155c92bff994f078aa2fe1fde85a1533bdf5cf3 | 34d392ae6622c051091b77b27ddbc8d2c5dd2cfe | jzajpt/ccxt | /python/ccxt/async_support/bleutrade.py | Python | py | 7,142 | permissive | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.bittrex import bittrex
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import Authenti... |
3df206fa00939b7bbba4b20de22a92daf7c2ad99 | 0f9dc3721815600d3292c06f6431e4686d7a3822 | ziyangz5/MinePilot | /src/AutoPilot/map_generator_hard.py | Python | py | 4,348 | no_license | from base_xml import get_base_xml
import random
random.seed(1)
class Cfg:
start_x,start_y,start_z = (1,2,-3)
# end_x,end_y,end_z = (-4,2,30)
maze_bound = (-4,-5,4,25)
number_of_walls = 5
end_block_type = "redstone_block"
road_block_type = "diamond_block"
wall_block_type = "iron_block"
se... |
d3528bc62c66dc594690fb4f4d447ceaf4b7c322 | 9b262b53940e01449cd16fda180c4f0d8de56379 | DoctorChe/Python_DataBase_PyQT | /client/utils/protocol.py | Python | py | 480 | permissive | import hashlib
from datetime import datetime
from .config_jim import ACTION, TIME, MESSAGE, DATA, TOKEN
# Функция создаёт текстовое сообщение
def create_message(action, data):
hash_obj = hashlib.sha256()
hash_obj.update(str(datetime.now().timestamp()).encode())
return {
ACTION: action,
TI... |
342152124a26b1f9bc7e954fbced9c2f130657fe | 4966b98b0eb7cd02e046953fb051a565dd23a65f | hannep/CommentOfTheWeekBot | /setup.py | Python | py | 569 | no_license | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
try:
long_description = open("README.rst").read()
except IOError:
long_description = ""
setup(
name="CommentBot",
version="0.1.0",
description="Runs comment of the week on Reddit. ",
license="MIT",
author="iro",
packag... |
637660126e864dea4176dae901578749920b91ad | 3ca7dd2057f58ab2f04ba3102e715573216082e2 | mattCensus/PerlScripts | /NGDAElimanator/NGDAEliminatorGood.py | Python | py | 17,480 | permissive | '''
File:SpatialRepresentationTypeUpdater.py
Date Created: 11/30/2018
Created by: Matthew McCready
Description: Updates an ISO metadate by inserting 'textTable' for the spatialRepresentationType. It also updates the
metadata date. It does this creating a new file to write all the changes. It then copies the new fi... |
8823a5c82e738ca3d62587afdd5a2b6995bbd120 | 8e45b2ae298d2404b38a3238dc2a44e394763f26 | maddevsio/django-webmoney | /webmoney/views.py | Python | py | 3,887 | no_license | try:
from hashlib import sha256
except ImportError:
from md5 import md5
from django.core.exceptions import ObjectDoesNotExist
from django.core.mail import mail_admins
from django.http import (
HttpResponse, HttpResponseBadRequest, HttpResponseNotAllowed)
try:
from django.views.decorators.csrf import c... |
be289fa2b8d6b9b3ad04e565b911733f0a680ac7 | ca012417dd2f7a6ac9ccb8d90627ef3f4b1c9941 | misaka-10032/leetcode | /coding/00125-valid-palindrome/test.py | Python | py | 521 | no_license | # encoding: utf-8
"""
Created by misaka-10032 (longqic@andrew.cmu.edu).
TODO: purpose
"""
from solution import Solution
def test_0():
sol = Solution()
assert sol.isPalindrome('')
assert sol.isPalindrome('a')
assert sol.isPalindrome(',,.*(#&@$')
assert sol.isPalindrome('a,!a')
def test_1():
... |
f82c24054bb0c06a0f88cff8fb5ad8ae952b7400 | 005dd57fbc15e6aa5213b14340c527da6752ac89 | Dnavarro805/Python-Programming | /Programming-Fundamentals/GeoGraph.py | Python | py | 3,136 | no_license | ################################################################################
## Student Name: Daniel Navarro Summer of 2016 ##
## Program Name: GeoGraph.py Ventura College ##
## Comments : Studying GEOMETRIC GRAPHICS. CS V11 ... |
765c82b48013c0aefb1fe98f247533bfb2530bc1 | fb2f763bb3734631339c4f8f75f49e57378da199 | chaobiubiu/RMAX-KNN | /rmax_knn_td_test_MountainCar3.py | Python | py | 2,144 | no_license | #different d_point in MountainCar
from rmax_knn_td import *
from rmax_knn_td_part import *
from rmax_knn_td_part2 import *
import gym
import matplotlib.pyplot as plt
x1=[]
y1=[]
x2=[]
y2=[]
x3=[]
y3=[]
x4=[]
y4=[]
x5=[]
y5=[]
def BenchmarkExperiment(Episodes,d_point,x,y):
print()
print('- - - - - -')
prin... |
efd4065dc81b9eb90e65e7c706cf8a4288f8dce7 | 8a4bea0b36e4d67e7d93c4736e93b8d6e5c51a49 | sophieboyle1/stile-ms4 | /bag/views.py | Python | py | 2,031 | no_license | from django.shortcuts import render, redirect, reverse, HttpResponse, get_object_or_404
from django.contrib import messages
from products.models import Product
def view_bag(request):
""" A view that renders the bag contents page """
return render(request, 'bag/bag.html')
def add_to_bag(request, item_id):
... |
8f3b526312e3c49856b278403550d08276bf4d0d | a6dfbfa2fbce98c0e82015b734da71d8cd6c08f3 | nimishb/refractor_framework | /bindings/python/swig/sub_state_vector_array.py | Python | py | 3,803 | no_license | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path imp... |
f4bd0473f2675d1d27246df5c2138a9859769c90 | aa3a1fe3b77698753e248699149cb39a03ad0fa5 | gajankumar1016/Artify | /similarity_model/stylesimilarity.py | Python | py | 803 | no_license | import numpy as np
import scipy.ndimage
import skimage.transform
def _load_raw_image(path):
img = np.array(scipy.ndimage.imread(path, flatten=False))
# np_image = scipy.misc.imresize(img, size=(512, 512)) / 255
np_image = skimage.transform.resize(img, output_shape=(224, 224))
return np_image
def _l2_i... |
c916e644133a3021449e2890042cc8949e48ec38 | a4e24675dcbac13b46fffa2be171fd46117b1b8b | albertmeronyo/dummyhub | /dummyhub.py | Python | py | 940 | no_license | import flask
import json
import os
app = flask.Flask(__name__)
@app.route("/")
def dummyhub():
return "DummyHub here! Try other routes, like /repos/<user>/<repo> or /repos/<user>/<repo>/contents"
@app.route("/repos/<user>/<repo>")
def dummyapi(user, repo):
d = {}
d['name'] = "DUMMY API for user {} and re... |
1a2acc6ae509b96130eaa4cd97452ebbaa683dae | a10d2b57ae588d837e6d6aedc0d10c2817515053 | ka-eun/Samsung_Data_Hackathon-1 | /model_O2_ensemble.py | Python | py | 7,644 | no_license | from preprocessing import category_O_preprocessing
from ml_utils import shuffleList, deleteColumn, separate_set_multiple_outputs
from ml_utils import majority, norm_list, plot_hist, value_key_map, oneHotEncoding
from keras.layers.core import Dense, Activation, Dropout
from keras.callbacks import EarlyStopping
from kera... |
ec10741de06b785746784a04093ca2a441c0117e | aff73644b1f9e1a015b94e214f92aa68596a7131 | vghchgd/tencent_ad-master | /tencent_ad-master/xgb_model.py | Python | py | 2,381 | no_license | # coding=utf-8
# @author:bryan
# blog: https://blog.csdn.net/bryan__
# github: https://github.com/YouChouNoBB/2018-tencent-ad-competition-baseline
import pandas as pd
import numpy as np
import xgboost as xgb
from xgboost import XGBClassifier
from sklearn.model_selection import train_test_split
from sklearn.feature_extr... |
8c619aa0a81d1878af743dd79134ffc9da2bc5ef | ffadfb0d9fba09dd8c41e8879f67ebe6dd52aaad | dshikashio/Pybag | /pybag/dbgeng/idebugregisters.py | Python | py | 3,844 | permissive | from ctypes import *
from comtypes.hresult import S_OK, S_FALSE
from . import core as DbgEng
from . import exception
from .dbgengstructs import DebugValue
class DebugRegisters(object):
def __init__(self, reg):
self._reg = reg
exception.wrap_comclass(self._reg)
def Release(self):... |
87234738580bbbf1314cd3a1ea53690a12c2d35b | 7ead792b35b8d84b18a322b582b633b92cce113c | kujaku11/sandbox_scripts | /archive_in_science_base.py | Python | py | 6,437 | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 12 12:55:59 2018
@author: jpeacock
"""
import os
import sys
from cStringIO import StringIO
import mtpy.usgs.usgs_archive as archive
import datetime
# =============================================================================
# Inputs
# ================================... |
5ee56a92b13cfe873f5d515adb244dd7e4ede6f1 | 677f6203a281d92454859ec2978776409ce06914 | n18010/programming-term2 | /src/basic-c4/0814/task/is_valid_filetype.py | Python | py | 500 | no_license | import re
user = input("テキスト形式のファイル名を入力してください>> ")
ng_name = re.match(r".*[/,<=>!?#$*+\\].*", user)
if ng_name is None:
txt_type = re.match(r".+\.txt$", user)
if txt_type is not None:
print('{0}は拡張子が".txt"のテキストファイルです'.format(user))
else:
print('{0}は拡張子が".txt"のテキストファイルではありません'.format(user)... |
e23a87e89ad6b831390250b2d795eac94ffd3553 | 6b002b4a533669dd0f5e82a00aa29224a83a7e57 | mktshhr/tensorflow-theta | /tensorflow/contrib/data/python/ops/scan_ops.py | Python | py | 6,992 | permissive | # Copyright 2017 The TensorFlow 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 applica... |
2bb726b1ca11ffa7de3f1df329e82584b7826aea | 7309b4eee6614ea698a240fcd80104ed8dc83593 | miljanic/cinetubbies | /backend/showtimes/migrations/0004_auto_20180523_2125.py | Python | py | 521 | no_license | # Generated by Django 2.0.4 on 2018-05-23 21:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('showtimes', '0003_auto_20180513_1938'),
]
operations = [
migrations.AlterField(
model_name='sho... |
d9ab4f752db90cc26b5adf0be3c38e2c11486bea | c8974e3625950e58afeca8898e6230b4a92b3ec6 | angr/claripy | /tests/test_fp.py | Python | py | 2,254 | permissive | # pylint:disable=missing-class-docstring,no-self-use
import math
import unittest
import claripy
class TestFp(unittest.TestCase):
def test_nan(self):
a = claripy.FPS("a", claripy.FSORT_FLOAT)
b = claripy.BVS("b", 32)
s1 = claripy.Solver()
s1.add((a + 1).isNaN())
res = s1.e... |
0a900f2b10da95e69f8e760c9e837163a8280851 | 438dc110209e63013a6206731d7bd376e0554aec | JJWizardMP/Python-Projects | /Geometría computacional/Parcial 1/Proyecto/Final/Mapas.py | Python | py | 4,497 | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def lista_bords2map(v, bordes, vc='b', bc='k'):
twins=[]
plt.axis('off')
plt.scatter(np.array(v.x), np.array(v.y), c=vc)
for i, bo in bordes.iterrows():
if not i in twins:
vin = bo['vert_or']
vfi = bo... |
ca09513f0e034bd660ae9813aaff2251045054e1 | fab4821208f46115637b664ccec93b97581f0374 | tefra/xsdata-samples | /travelport/models/type_search_address_1.py | Python | py | 1,763 | no_license | from __future__ import annotations
from dataclasses import dataclass, field
__NAMESPACE__ = "http://www.travelport.com/schema/sharedUprofile_v20_0"
@dataclass
class TypeSearchAddress1:
"""
The address of the profile to search for.
Parameters
----------
address_line
Street (must match exa... |
d7f925b3ae7c9ef4ab6ecd9ba1f9d2446473b529 | 9be5699fa463e2981a92e7132f212db5075082b9 | ZiggyStarProgrammer/langames | /src/table_builders.py | Python | py | 2,193 | no_license | class HtmlTableBuilder:
"""Produces HTML table code to be inserted into a larger HTML document"""
def __init__(self):
self.rows = []
def set_headers(self, column_headers):
self.headers = column_headers
def add_row(self, cells):
self.rows.append(cells)
def get_html(self):
... |
2948c8062ef375334f981e418b91f4255819a852 | ffcc403f959c22ff8c82259edb9460b36b986819 | timothyrenner/bfro_sightings_data | /pipeline/update_reports.py | Python | py | 3,889 | permissive | from prefect import flow, task, get_run_logger
import typer
from pathlib import Path
import polars as pl
import duckdb
from prefect_shell import ShellOperation
@task(name="Run scraper")
def run_scraper_task(reports_new_file: Path, test_run: bool = False) -> Path:
logger = get_run_logger()
logger.info("Firing ... |
4bde27e432e632f978a19c2312d3bd45bcd6fef4 | 19117a3febc0467ca5cfae31fc122bf97de39fd8 | MengzeWang/rctt | /batchDownload/telnet2Dev_BD.py | Python | py | 18,037 | no_license | #-*- encoding: utf8 -*-
__author__ = 'MengZe'
import time,re,os,sys
import multiprocessing
sys.path.append('D:\pyS\peopleCanRestButDevCannot\\')
import telnet2Dev
import ip_get_test as IGT
class DevClass_BD(telnet2Dev.DevClass):
def __init__(self,DevIp,DevIpMask='255.255.255.0',FtpIp_usr=None):#超时时间,单位s
se... |
7ebb464c4a7c478d8e65605b4a461572cc81eebf | 8c97e082d651bb636962c554c02daee62ab1986b | kartik4949/detectia | /detectia/engine/backbone/efficientnet.py | Python | py | 42,441 | permissive | """Contains definitions for EfficientNet model.
[1] Mingxing Tan, Quoc V. Le
EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.
ICML'19, https://arxiv.org/abs/1905.11946
"""
import os
import re
import collections
import functools
import itertools
import math
from absl import logging
import... |
9bb0cf3c4e2fa6644ff0866d1edeeaac2263085b | 3f351e157e0903cb1116bd7e40cf42fd88e8ba19 | johnmwilson82/finance_apps | /gui/yql_finance_app_gui.py | Python | py | 1,638 | no_license | import yql_finance_app_base
import wx
import threading
class FinanceAppGui(yql_finance_app_base.FinanceAppGuiBase):
def __init__(self, parent, app):
super(FinanceAppGui, self).__init__(parent)
self.app = app
self.updateSymbolsList()
self.updateSectorsList()
self.updateIndust... |
a4009168f5f013f2e4f9334498e82ab27280eaf7 | eaa50572886aca09a703b30a99abf5e3b8a4f272 | JaySurplus/online_code | /leetcode/python/36_ValidSudoku.py | Python | py | 1,561 | no_license | """
Valid Sudoku
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.
The Sudoku board could be partially filled, where empty cells are filled with the character '.'.
https://leetcode.com/problems/valid-sudoku/
"""
class Solution(object):
def isValidSudoku(self, board):
"""
... |
5d30c9646a7f6b9a7d93ae8656bf9b1e6b5786ce | 857de2eaf2aad09ad15f73ed52d714489bb766ba | chiefmo/csb351 | /a4/a4.py | Python | py | 1,942 | no_license | #!/usr/bin/python3
### CSCI-B 351 / COGS-Q 351 Fall 2021
### Framework code copyright 2020 B351/Q351 instruction team.
### Do not copy or redistribute this code without permission
### and do not share your solutions outside of this class.
### Doing so constitutes academic misconduct and copyright infringement.
... |
9a9e8a6e5c5b755d5055ae6c74469635b8b7e891 | 1318049b783a68d2e7b04b85e58310d7819e7c4a | childxr/lintleetcode | /KnightShortestPathII/solution.py | Python | py | 1,169 | no_license | class Solution:
"""
@param grid: a chessboard included 0 and 1
@return: the shortest path
"""
def shortestPath2(self, grid):
# write your code here
n = len(grid)
if n == 0:
return -1
m = len(grid[0])
if m == 0:
return -1
f = [... |
a09e9895d38843c9ec7b6e622f6f47fb8e403628 | 09e35be4796aa20a9813b51af4ee0a4195900e9d | nwalk/university_api | /apps/university_locations/json_views.py | Python | py | 1,464 | no_license | from apps.university_locations import models, serializers
from rest_framework import generics
import django_filters
# views section of quick start guide
# http://www.django-rest-framework.org/tutorial/quickstart
class IntegerListFilter(django_filters.Filter):
def filter(self, qs, value):
if value not in ... |
69b6af8be5d5623bb8a770be0ed028ae2d10925f | 14b7e89642ebbacb0514fd236092e5b25d03138d | EleComb/game_learning | /Python/02_bomb_catcher/c_bomb_catcher.py | Python | py | 2,399 | no_license | # Bomb Catcher Game
# Chapter 4
import sys, random, time, pygame
from pygame.locals import *
def print_text(font, x, y, text, color=(255, 255, 255)):
imgText = font.render(text, True, color)
screen.blit(imgText, (x, y))
# main program begins
pygame.init()
screen = pygame.display.set_mode((600, 500))
pygame.... |
1079bb8dd50ff31edc7667a6078c39fb5b9d2788 | e4365b3abcb4c26c4224d778dcbc82d2060a2c6d | J-pcy/Jffery_Leetcode_Python | /Easy/717_1-bitand2-bitCharacters.py | Python | py | 1,085 | no_license | """
We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11).
Now given a string represented by several bits. Return whether the last character must be a one-bit character or not. The given string will always end with a zero.
E... |
8252da97094eba1171493508f49e92592b7be0a8 | b449c674f205efdf4aa80e99bd52c9f8d649b989 | mraxu/network_device_script | /网络设备脚本/普联网页/无线局域网.py | Python | py | 1,357 | permissive | import time
import cflw代码库py.cflw网络地址 as 地址
from ..基础接口 import 无线局域网
from . import 模式
class C无线电接口配置(无线局域网.I接口配置):
"""适用于: wdr5620"""
def __init__(self, a设备):
self.m设备 = a设备
def f显示_主机表(self):
return C主机表(self.m设备)
class C主机表:
"""适用于: wdr5620"""
def __init__(self, a设备):
self.m设备 = a设备
def __iter__(self):
... |
7bd853a70ee401569a0a8cc56710497f071c8558 | 3efe82b5b5996e7dc2cdc41346abd6a93c07bf72 | ProfessorQu/Mechanic | /sharpy-sc2/python-sc2/sc2/generate_ids.py | Python | py | 8,649 | permissive | import json
import platform
import subprocess
import importlib
import sys
from pathlib import Path
from loguru import logger
from .game_data import AbilityData, UnitTypeData, UpgradeData, GameData
try:
from .ids.id_version import ID_VERSION_STRING
except ImportError:
ID_VERSION_STRING = "4.11.4.78285"
class... |
c9cd4b21b33c331353ba007ba1153d5669983483 | 299584eb3be352fd485d57b196fc9f878bdddc59 | merkushov/hexlet | /python-project-lvl3/tests/test_cli.py | Python | py | 604 | no_license | """Automatic test to verify processing of command line arguments"""
import sys
import pytest
import page_loader.cli
def test_parse_arguments_return_values():
sys.argv = [
"page_loader",
"https://ru.hexlet.io/"
]
args = page_loader.cli.parse_arguments()
assert(
isinstance(args,... |
e62682f64e1e5e8ad06b7cbfe71c3ee86e208d47 | bae3b4cef699d48c6c0924ed32cf77a2ba7a7634 | NKanazawa/IterativeNK | /NKProject-IBEA/src/CMOP5.py | Python | py | 13,051 | permissive | import array
import sys
import random
import json
import subprocess
import pandas
import numpy
import scipy
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from math import sqrt
from deap import algorithms
from deap import base
from deap import benchmarks
from deap.benchmarks.tools import hypervol... |
f018374b2bf76e17343958a01bc411dcb363e4e5 | 7aece103a0da865b4e4d0753b0c5be875a87c143 | Delphi89/German-Credit-Private- | /German-Credit-Private--master/ex288.py | Python | py | 17,004 | no_license | #!/usr/bin/env python
# coding: utf-8
# best score: 125
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data as Data
import torch.optim as optim
import torchvision
from torch.utils.data.sampler import SubsetRandomSampler
from torch.utils import data
import numpy as np
import os
i... |
dfcb7229966b58feeaef1b720955a0b4cd441f36 | 4cdb47049a332936c69b0609b682ae391174b599 | Vagus30/time_series_day_02_project | /q07_randomforest_regressor/build.py | Python | py | 412 | no_license | import pandas as pd
import numpy as np
import math
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_squared_error
from greyatomlib.time_series_day_02_project.q05_feature_engineering_part4.build import q05_feature_engineering_part4
from greyatomlib.time_series_day_02_project.q02_data_s... |
3e6bbc26caf66ebe5f2710e2c28bca54cf10af51 | 9d045523493c99d3693d0d803c0cf300eff8b5f8 | kaysiz/PyConZim | /localsettings.py | Python | py | 248 | no_license | import os
from settings import *
ALLOWED_HOSTS = "localhost"
SECRET_KEY = 'dfdjkhfdjshfj7676dfhgsdj'
DEBUG = "False"
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'pycon',
}
}
|
899c8cde57336c154c65dc96898d9bee0e903166 | acdf3999d428d6ef3550f07754612a19af12855c | virthead/COMPASS-ProdSys | /prodsys/migrations/0001_initial.py | Python | py | 2,388 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-21 15:04
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Create... |
a83037482fd1f75ab7e10e15b3cc9ff45daf2796 | 6b0eff2f0362ebb03bbe3d2e84c6c309f95231af | Ekats3529/full-search | /scale.py | Python | py | 384 | no_license | import math
def get_delta(a, b):
degree_to_meters_factor = 111
a_lon, a_lat = a
b_lon, b_lat = b
# Берем среднюю по широте точку и считаем коэффициент для нее.
radians_lattitude = math.radians((a_lat + b_lat) / 2.)
lat_lon_factor = math.cos(radians_lattitude)
return str(lat_lon... |
0e0f427f750dd59700fa184e93afeebd5ad1e6f2 | ea7741f262d95eb643183ee2cfecfb901d98dec7 | michal-franc/CodingKatas | /interview-cake/meeting_times_merging.py | Python | py | 1,033 | no_license | #Your company built an in-house calendar tool called HiCal. You want to add a feature to see the times in a day when everyone is available.
# Examples
#[(0, 1), (3, 5), (4, 8), (10, 12), (9, 10)]
#[(0, 1), (3, 8), (9, 12)]
def merge_time(meetings):
sorted_meetings = sorted(meetings)
overlapped_meetings = [s... |
cace90a851fe5cf154cd620a370e975e4a1586f6 | 06c81cd683bcf5590b83204cd7625db81eae9dc8 | Virtlink/ccbench-chocopy | /cases/synthetic/tree-big-8305.py | Python | py | 23,265 | no_license | # Binary-search trees
class TreeNode(object):
value:int = 0
left:"TreeNode" = None
right:"TreeNode" = None
def insert(self:"TreeNode", x:int) -> bool:
if x < self.value:
if self.left is None:
self.left = makeNode(x)
return True
else:
... |
1dd3d59778c85dcfa5f0c13a013dd8586ffc3f9f | 98bf9f064dc1d79c346be57e409afb8669c2699a | RyanRawlings/ProgrammingProblems | /CodingBat/Python/List_1/first_last6.py | Python | py | 540 | no_license | # **********************************************************************************
# Title: List-1 > first_last6
# URL: https://codingbat.com/prob/p181624
# Date: 12/06/2021
# Description:
# - Given an array of ints, return True if 6 appears as either the
# first or last element in the array. The ... |
92cb650d33cf2537a3cc191481d079d98d135a5d | fbfca852f06ad7a1793f7f3147e8011aaeaa5062 | lizhenggan/TwentyFour | /01_Language/01_Functions/python/pathinfo.py | Python | py | 413 | permissive | # coding: utf-8
from os import path
def pathinfo(p):
filename, ext = path.splitext(path.basename(p))
return {
'dirname': path.dirname(p),
'basename': path.basename(p),
'extension': ext,
'filename': filename,
}
if __name__ == '__main__':
print(pathinfo('./text.txt'))
... |
de926c4b03ca54c066c21e519099441f086e05dc | bb88a95700a69ec7815915735dd5463d64ea400c | AdrianLeonLhy/sui | /sui/ml/mf/svdpp.py | Python | py | 1,220 | permissive | """
Date:
Author:
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import pickle
import random
import sys
import time
import numpy as np
from .svd import SVDModel
__author__ = ['Li Tang']
__copyright__ = 'Li Tang'
__credits__ = ['Li Tang']
__license__ = 'MIT'
__version__ = '0.1.7... |
e5e9c7d6024745e0560592b15ca7102c6333c94b | 8301382ad1ddb2419f9f1f4bc3bcab774501eb0f | pythexcel/ethermon | /common/loggerconfig.py | Python | py | 18,336 | no_license | # Copyright 2009-2010 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this perm... |
40e49d02697a81331101a5c7e6c1b4a44aa1aa47 | 2e7d8731a1b3a7219fc51d2c84358f8567bc5418 | seberg/pandas | /pandas/core/algorithms.py | Python | py | 8,812 | permissive | """
Generic data algorithms. This module is experimental at the moment and not
intended for public consumption
"""
import numpy as np
import pandas.core.common as com
import pandas.algos as algos
import pandas.hashtable as htable
def match(to_match, values, na_sentinel=-1):
"""
Compute locations of to_match... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.