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 |
|---|---|---|---|---|---|---|---|---|
7d2589e1a6369df15d1689848d9cf71b207bd38a | 61d4fcd171e3bf864f16ee717f0e9784b820361e | AdamBhavnani/PythonProjects | /RandomMapGenerator/kevin_RM.py | Python | py | 4,984 | no_license | import random
import argparse
import functools
from PIL import Image
# Colors for dungeon cells
COLOR_EMPTY = (28, 15, 0)
COLOR_TUNNEL = (185, 168, 125)
COLOR_TREASURE = (217, 217, 217)
COLOR_MONSTER = (164, 8, 2)
def constrained(f, min_value=None, max_value=None):
"""Helper function to constrain a castin function ... |
d4b3fdd78d59e58a85df1aa0a8eba74676591801 | b5046a5e8f30168e78540fa885bcce783f63e71e | antoniorafaelbraga/greatdatacenter | /gateway/GreatDataCenterGateway/src/persistence/Connection.py | Python | py | 2,159 | no_license | '''
Created on 21 de nov de 2016
@author: rafaelbraga
'''
from pymongo import MongoClient
''' Classe que conecta com o banco de dados '''
class Connection(object):
''' Constructor '''
def __init__(self, server, port):
connection = MongoClient(server, port)
db = connection['greatDataCenter']
... |
be4378287946a013d73f705c3e4a8d37f9573cf2 | 97115adf1d458343cb0cca3aae488c4605094f2d | anyavoitovich/project234 | /habrclone/errors.py | Python | py | 274 | no_license | from flask import render_template
from habrclone import App, db
@App.errorhandler(404)
def not_found(error):
return render_template('404.html'), 404
@App.errorhandler(500)
def internal_error(error):
db.session.rollback()
return render_template('500.html'), 500 |
f8b7a1df4f95e341272a94c0fb63d1dfc24a301b | be78a183bbc1c2a950b1202a2bf613b27c8c42aa | ahervi/Bluetooth-Tracking-Random-Forests | /Analysis/Scripts_and_images/wedmo/Youden/thresholds/MainSubProbThreshold .py | Python | py | 18,305 | no_license | import csv
import sqlite3
import numpy as np
from sklearn.ensemble import RandomForestClassifier
import random
import difflib
import math
import numbers
import pickle
import matplotlib.pyplot as plt
import operator
import itertools
import math
import datetime
import scipy as sp
import scipy.stats
def mean_confidence_in... |
d79dd5d971bd5e1bbd3da30a096ddcd88ce69393 | 08b9d237f6c10e5c2ff214d80c1b97110c37312a | jgse/eiffel-pythonlib | /eiffellib/events/eiffel_test_case_triggered_event.py | Python | py | 1,670 | permissive | # Copyright 2019-2021 Axis Communications AB.
#
# For a full list of individual contributors, please see the commit history.
#
# 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... |
693ebceee7c109b2953446ff777ba85dfa084bd8 | 5fbc44a31b8578d4db7e7302310328df1ddf99be | ikang9712/Mayan-EDMS | /mayan/apps/linking/tests/mixins.py | Python | py | 13,995 | permissive | from django.db.models import Q
from ..models import SmartLink, SmartLinkCondition
from .literals import (
TEST_SMART_LINK_CONDITION_FOREIGN_DOCUMENT_DATA,
TEST_SMART_LINK_CONDITION_EXPRESSION,
TEST_SMART_LINK_CONDITION_EXPRESSION_EDITED,
TEST_SMART_LINK_CONDITION_INCLUSION, TEST_SMART_LINK_CONDITION_O... |
c21e6c0c4f1fc2b6d1a598877c9c4de60fb14740 | 090af766fc32babdb093371f968e669b3e590765 | robhawkes/WoT-Dossier-Parser-Create-Struct | /.OLD_FILES/dossiers2_old1/custom/records.py | Python | py | 104,258 | permissive | # uncompyle6 version 2.11.3
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
# Embedded file name: scripts/common/dossiers2/custom/records.py
RECORDS = (
('total', 'creationTime', 'p', 'I', 4000000001L),
('total', 'lastBattleTime', 'p', 'I', 4... |
c4cd57b644b7da5ebc90f75348e50c1a7bd40c51 | e21bc74dd3bf19cfe6ad87b3c1f180575be9e00d | sprax/1337 | /python2/l0301_remove_invalid_parentheses.py | Python | py | 1,079 | no_license | class Solution(object):
def removeInvalidParentheses(self, s):
"""
:type s: str
:rtype: List[str]
"""
def is_valid(s):
count = 0
for c in s:
if c == '(':
count += 1
elif c == ')':
... |
849af703e3e41e22e2f9260f71cc1ce7cad857ef | 988f3d10b15cb5b440ba7a0c47b69c78afa1b07d | splunk/eventgen | /splunk_eventgen/lib/plugins/generator/weblog.py | Python | py | 2,670 | permissive | import random
import time
from splunk_eventgen.lib.generatorplugin import GeneratorPlugin
class WeblogGenerator(GeneratorPlugin):
def __init__(self, sample):
GeneratorPlugin.__init__(self, sample)
f = open("tests/sample_eventgen_conf/perf/weblog/external_ips.sample")
self.external_ips = ... |
b6f8a60611dbd4f7a3765e9e2ed6818a2bb07b62 | 839a260cf58e18adcc14f648cb092985e8d0628f | youknowone/learn-python3-thw-code-ko | /ex43_classes.py | Python | py | 780 | permissive | class 장면(object):
def 입장(self):
pass
class 엔진(object):
def __init__(self, 장면_지도):
pass
def 플레이(self):
pass
class 사망(장면):
def 입장(self):
pass
class 중앙_복도(장면):
def 입장(self):
pass
class 레이저_무기고(장면):
def 입장(self):
pass
class 함교(장면):
def... |
33362902200572857ddcb97d335a8953a647613a | 213d75fd325b2199ccf1f4a0fd06f2f442ac4524 | adler-j/adler | /adler/tensorflow/unet.py | Python | py | 24,413 | permissive | import demandimport
with demandimport.enabled():
import tensorflow as tf
import numpy as np
from adler.tensorflow.layers import (conv2d, conv2dtransp,
conv1d, conv1dtransp,
maxpool2d, maxpool1d)
from adler.tensorflow.activation import prelu,... |
7a99f8320bcc9eaf42e320acb78a93f2bfe2d1dd | 85efc92bb5db24f89673c10768aaf0416490aa3f | happylrd/leetcode-training | /Python/238_Product_of_Array_Except_Self.py | Python | py | 563 | no_license | class Solution(object):
def productExceptSelf(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
n = len(nums)
ans = [1] * n
left = 1
for i in range(n - 1):
left *= nums[i]
ans[i + 1] *= left
right = 1
... |
efd20db278178cbe943231dcd23884b66ce3ca17 | 4070dbec4fba25509bd557c90416fa2b1ae314bf | authman/Python201609 | /Guerrero_Melissa/Assignments/Random_Word_app/config/routes.py | Python | py | 1,863 | permissive | """
Routes Configuration File
Put Routing rules here
"""
from system.core.router import routes
"""
This is where you define routes
Start by defining the default controller
Pylot will look for the index method in the default controller to handle the base route
Pylot will also automaticall... |
8c5d782e0b49e53ad51d71c29fea3c1d9e5d6659 | c3856d8d53ae71a68517603fdef55c910f1eb6a0 | SupriyaMadupathi/CSSP-1 | /cspp1-assignments/m9/p2/assignment2.py | Python | py | 1,316 | no_license | '''
Exercise: Assignment-2
Next, implement the function getGuessedWord that takes in two parameters
a string, secret_word, and a list of letters, letters_guessed. This function
returns a string that is comprised of letters and underscores, based on what
letters in letters_guessed are in secret_word. This shouldn't be t... |
308548e0b73e4ba9561c1288922b50a2d5642fd1 | 5081a3d3208e30acbb69b74e1aa080f45aaf5c70 | mbal/jing | /python/p204.py | Python | py | 503 | no_license | def primes(limit):
p = [2, 3, 5, 7]
for i in xrange(3, limit, 2):
for k in xrange(3, int(limit**.5) + 1):
if i % k == 0:
break
else:
p.append(i)
return p
LIMIT = 10**9
factors = primes(100)
prev = [1]
c = 1
while True:
new = set()
for item in... |
082f1d0445b34cca550932583c4cdbbd13dad026 | 676d144a696f997991252093b0bf3e88024a2b6b | Pumpkin-Studios/ToolPlus | /2.78/Sets/toolplus_display/display_normals_transfer.py | Python | py | 9,907 | no_license | # ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distri... |
cf9d539235325e31171d0bee406cd489da46ef49 | 024d5a1ca2dcac6110ea5a701c57d40825998357 | manishbanyal/singh | /project3-master/app1/forms.py | Python | py | 1,079 | no_license | from django import forms
from .models import UserModel, PostModel, LikeModel, CommentModel, LikeComm
# it is the signup form which extends the django forms class
class SignUpForm(forms.ModelForm,):
class Meta:
model = UserModel
fields=['email','username','name','password']
# it is the log in form which extends the... |
b9d5566d68178933068c8b8d37eeeafb093c53a9 | 429426936a24ffc6a11786c455b71c1652573fed | osherson/diffmo | /Ntuplizer/test/crab_data_run_A.py | Python | py | 1,712 | no_license | from WMCore.Configuration import Configuration
config = Configuration()
config.section_('General')
config.General.transferOutputs = True
config.General.requestName = 'Data_Run_A_v4'
config.section_('JobType')
config.JobType.psetName = 'hadronic.py'
config.JobType.pluginName = 'Analysis'
config.JobType.inputFiles = ['... |
cfadda10c6215a42c3db7cfa67fc281808070c53 | 074a16deaea66347ad370bbb49f96c1d191af912 | mzkaramat/AI-For-Robitics | /Assignment3/FinalCode.py | Python | py | 12,133 | no_license | # --------------
# USER INSTRUCTIONS
#
# Now you will put everything together.
#
# First make sure that your sense and move functions
# work as expected for the test cases provided at the
# bottom of the previous two programming assignments.
# Once you are satisfied, copy your sense and move
# definitions into the robo... |
e7743aa80e0a83fe1dea005d6f2e26fb041afaf9 | 7b5100e39babb21a2fe0a1a2e1ab988b70fe889f | bobzz-zone/MassEdit | /massedit/hooks.py | Python | py | 2,435 | permissive | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "massedit"
app_title = "Mass Edit"
app_publisher = "bobzz"
app_description = "Mass Edit is a Bulk Edit"
app_icon = ".octicon-pencil"
app_color = "grey"
app_email = "bobzz.zone@gmail.com"
app_license = "M... |
b7d59d75b9f52cef71a0ea874e8b2d6177166945 | ce766ad7c837f4d7ba752f347843fab5dbf71abc | maksimysopero/python_2 | /Код_меток.py | Python | py | 1,050 | no_license | # Кодирование меток
import numpy as np
from sklearn import preprocessing
input_labels = ['red','black','red','green','black','yellow','white'] #Этикетки напечатаны следующим образом
encoder = preprocessing.LabelEncoder()
print(encoder.fit(input_labels))
test_labels = ['gree... |
de524c0e47cd7e93a120882461c94d680e8806ea | 31a2a091c4172f672b9755eb200eb33e898973c9 | ZeroFuture/mlflow | /mlflow/_spark_autologging.py | Python | py | 9,669 | permissive | import concurrent.futures
import logging
import sys
import threading
import uuid
import gorilla
from py4j.java_gateway import CallbackServerParameters
from pyspark import SparkContext
from pyspark.sql import SparkSession
from mlflow.utils._spark_utils import _get_active_spark_session
import mlflow
from mlflow.except... |
49da07cd7c97e8ad0ce86fb3354baa656e1cebea | a985873e0b2d6e4d00b1da89193ba5fc8cac82d2 | sibudi/generate-ojk-report | /minipymysql/converters.py | Python | py | 7,484 | no_license | from._compat import PY2,text_type,long_type,JYTHON,IRONPYTHON,unichr
import datetime
from decimal import Decimal
import re
import time
from.constants import FIELD_TYPE,FLAG
from.charset import charset_by_id,charset_to_encoding
def escape_item(val,charset,mapping=None):
if mapping is None:
mapping=encoders
encoder=m... |
1ff14cd47321f1dffb5c289fb5601582e03eea26 | cd8c6c04fae1757314f7d4a1213f1130aebbeafd | RASESH-THECODER/C-109 | /height.py | Python | py | 3,338 | no_license | import pandas as pd
import statistics
import csv
df=pd.read_csv("height-weight.csv")
height_list=df["Height(Inches)"].to_list()
weight_list=df["Weight(Pounds)"].to_list()
height_mean=statistics.mean(height_list)
weight_mean=statistics.mean(weight_list)
height_median=statistics.median(height_list)
weight_m... |
5a7d3ddce0c92485204a0b6e2f75bf5110d49541 | f6b6b27a36d349c27c106fbc18bda816b42e4397 | Lucas-Irvine/Particle-Cloud-Framework | /pcf/core/pcf.py | Python | py | 3,249 | permissive | # Copyright 2018 Capital One Services, LLC
#
# 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... |
ba7dace7a20a0204a9eb38e69fe50979c89897f9 | ca7cd1cfc069e58fda882598fd40ced3ec613c45 | vodono/new_order | /src/tasks.py | Python | py | 318 | no_license | from invoke import Collection
from commons.tasks import shell
from excel_read.excel_read import excel_read
from db.tasks import db_update
from orders_import.orders_import import today_orders_import
ns = Collection()
ns.add_task(shell)
ns.add_task(excel_read)
ns.add_task(db_update)
ns.add_task(today_orders_import)
|
ed45af105b0d282d34da6a3e34643b301af6c579 | 336419cfd32668f0b4610ae31179ca1df10af429 | changlan/tensor2tensor | /tensor2tensor/bin/t2t_attack.py | Python | py | 9,996 | permissive | # coding=utf-8
# Copyright 2023 The Tensor2Tensor Authors.
#
# 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... |
8b5cf550055fe9917b9148d500b66e2dc9549fa8 | 088c38a1ff333eb3f6b1b4ad8b3967f968149d4c | facebookresearch/theseus | /theseus/constants.py | Python | py | 627 | permissive | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from typing import Optional, Union
import torch
TEST_EPS = 5e-7
EPS = 1e-10
PI = math.pi
__FROM_THESEUS_LAYER_TOKEN__ = "__FRO... |
b4fe3988e1d7fe71b85ad9ae76b562aa32a1a963 | 59ed109d29c5877f5a21fc39b8742e756f6ab05c | psyde26/learn_web | /create_event.py | Python | py | 818 | no_license | from datetime import date
from webapp import create_app
from webapp.model import db, Event, Type, Country
app = create_app()
with app.app_context():
event_name = input("Название события: ")
str_date_start = input("Дата начала: ")
date_start = date.strptime(str_date_start, '%d/%m/%y')
str_date_fin... |
3d5ee6941813fcf4141d63abac9982caa15e7762 | 6517cc5035b07d2a5b49fd727a2fda3fb0cc9d3e | jessica-lemes/Projeto-Estoque | /Banco/Movimentacao_dados.py | Python | py | 2,720 | no_license | import sqlite3
class Querys_movimentacao:
def __init__(self, banco):
self.conexao = sqlite3.connect(banco)
self.cursor = self.conexao.cursor()
def cadastra_movimentacao(self,tipo, qtde, idProduto_FK, idUsuario_FK):
try:
self.conexao = sqlite3.connect('estoque.db', timeout=... |
ea6ade448c116b481a6b253b18ba3601ef32453c | e081c21c85ad9ee1e995288af41fde1ea261f926 | kmpujar/Image-Description-Generation | /Main.py | Python | py | 9,162 | no_license | import torchvision.transforms as transforms
import torch
import torch.nn as nn
from Image_Description.Model import EncoderModel, DecoderModel
from Train_Attention import train_attention_model
import numpy as np
from torch.utils.data import DataLoader, random_split
from torchtext.vocab import Vocab
from collections impo... |
01380e4b8eff7258a245d039698fd5260d2de960 | 0507707ef0b65d1ab97938b9e116a0d8324166b1 | nhat-tran-230297/LungCancerDetector | /lung/app/base/forms.py | Python | py | 405 | permissive | from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from wtforms import SubmitField
from wtforms.validators import DataRequired, ValidationError
class AnonymousForm(FlaskForm):
raw_file = FileField('RAW', validators=[DataRequired()])
mhd_file = FileField('MHD', validators=[Data... |
f4fef9c5c9b197a1191d17f874ab0cbf76027cfe | 6b8de43b16e8fcb3aa607fe172d7f17b10f2d63a | asqum/PYQUM | /SKILLS/asqpu/src/qpu/backend/circuit/compiler.py | Python | py | 13,493 | permissive | import qpu.backend.phychannel as pch
from qutip import sigmax, sigmay, sigmaz, basis, qeye, tensor, Qobj
from qutip_qip.operations import Gate #Measurement in 0.3.X qutip_qip
from qutip_qip.circuit import QubitCircuit
from qutip_qip.compiler import GateCompiler, Instruction
import numpy as np
import qpu.backend.circuit... |
23d55b906b755edc6df59d937b43b5e4c6cf4483 | 5b63f362417d417f3cdbe8a99b8e5916b3bdf8f0 | jonahweissman/comp-neurosci-crcns-vta-1 | /setup.py | Python | py | 593 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- mode: python -*-
import sys
from setuptools import setup
if sys.hexversion < 0x02070000:
raise RuntimeError("Python 2.7 or higher required")
setup(
name="comp-neurosci-crcns-vta-1",
version="0.0.1",
package_dir={'comp-neurosci-crcns-vta-1': 'src'},
... |
ddb49a9d80c9b3e1bc28092dc72d72630fbd2988 | e5dd7b90b9e95b24acd6543909f9d51bb9da9e6e | akarazhev/zero | /zero/common.py | Python | py | 933 | permissive | def check_allowed_types(msg, rpc_method=None):
if isinstance(msg, (dict, str, int, float, bool, list, tuple)):
pass
else:
if rpc_method:
raise Exception(
f"return of `{rpc_method}` should be any of dict, str, int, float, bool, list type; found {type(msg)}"
... |
fe10f40c3325e34e7c7d33e2cf1096183ed17131 | f91b10a07c73a0cb8ba24cd635557513064855d7 | inwk6312fall2018/model-open-book-quiz-golla-prashanth | /task-1.py | Python | py | 1,253 | permissive | import pyCardDeck
from pyCardDeck.cards import PokerCard
#allocating all numbers under all suits
def number_of_cards():
card_list=[]
french_suit = ["Hearts","Spades","Clubs","Diamonds"]
map= {'A':'Ace','2':'Two','3':'Three','4':'Four','5':'Five','6':'Six','7':'Seven','8':'Eight','9':'Nine','10':'Ten','J':'Jack',... |
27c67e791fc2afa57e32e477e8fd85bb1d5f3d74 | 7cd04173a0060579492bcbeedcff8304b235e222 | driellevvieira/ProgISD20202 | /Gilberto/Aula 7/AtividadeContextualizada07.py | Python | py | 4,894 | no_license | # Atividade Contextualizada 07
#Primeiramente vamos importar os módulos necessários
import time
import random
#Vamos criar uma classe para o Experimento, Eletrodo e Dispositivo.
class Dispositivo:
''' Criação de um dispositivo que utilize RGB'''
def __init__(self, entradaEletrodos, tempo):
print(... |
11ea22f651f6652e446fe295bba62799f7861ea0 | f19f8b7af5b167d30d6efd9c0f3871a1f94585f1 | minhlongmt183/PPL | /Assignment/assignment2/initial/src/toolkit.py | Python | py | 1,751 | no_license | import re, sys
from os import listdir
from os.path import isfile, join
if __name__ == "__main__":
# Get all solutions
solution_files = [f for f in listdir('test/solutions/') if isfile(join('test/solutions', f)) and f.endswith('.txt')]
print(solution_files)
dic = {}
for f in solution_files:
... |
72cbc45f65af34ca45ce50a360e7da39ba722bc9 | 69b9cc0933550fe03bd1801960f57a9dde270780 | psatyajeet/rependo | /mysite/reimbursement/urls.py | Python | py | 591 | no_license | from django.conf.urls import patterns, url
from reimbursement import views
urlpatterns = patterns(
'',
url(r'^$', views.index, name='index'),
url(r'^login', views.login, name='login'),
url(r'^signupindividual', views.signup_individual, name='signup_individual'),
url(r'^signuporganization', views.s... |
b2041a156dc32127337606b5da466356cde667d5 | 9a2f3102ffe29c945b108e8ea7589b09ff3d425c | Thmyris/linux.cfg | /files/dirsearch/lib/utils/DefaultConfigParser.py | Python | py | 2,552 | permissive | # -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope... |
45eb721e2fc59b3f313626a67c74ef617ae466eb | 54cfe5c6a38fe6bd000994ef2e31b3b2ef53f6d4 | sunhemi/FlameSales | /tango_with_django_project/flame/migrations/0001_initial.py | Python | py | 2,115 | no_license | # Generated by Django 3.0.7 on 2020-06-09 22:02
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
f46c8e234a8e4c4323ed17ce365e32fb7811f608 | 01a2210e7c9bf80f24fe7ef601aab06e47443b91 | ClayLiu/Soft-ClusteringAlgorithms | /algorithms/sSFCM.py | Python | py | 3,384 | permissive | import numpy as np
from common.constant import *
from common.clusteringAlgorithms import Semi_SupervisedWithPrioriKnowledgeClusteringAlgorithm
from utils.distance import get_EuclideanDistance_matrix
from utils.distance import MinkowskiDistance
class sSFCMA(Semi_SupervisedWithPrioriKnowledgeClusteringAlgorithm... |
3ef51dd250bb671be522dca54d43dd74f1e8bfb2 | 1828e553327ec63587c77767dd828a8b69597086 | awlx/peering-manager | /peering/tables.py | Python | py | 17,074 | permissive | import django_tables2 as tables
from django.utils.safestring import mark_safe
from net.models import Connection
from peering_manager import settings
from utils.tables import (
BaseTable,
BooleanColumn,
ButtonsColumn,
SelectColumn,
TagColumn,
)
from .models import (
AutonomousSystem,
BGPGro... |
5d494fa45750fc18039137306fb58104741a828b | 9dcfd158af4aee67e3bc3f15460c3d52bddde3ce | DaHuO/Supergraph | /codes/CodeJamCrawler/16_2_1/akshayub/1 - Copy.py | Python | py | 2,154 | no_license | test = input()
for g in xrange(test):
s = raw_input()
s = list(s)
ans = []
while(1):
if 'Z' in s:
ans.append('0')
s.remove('Z')
s.remove('E')
s.remove('R')
s.remove('O')
else:
break
whil... |
f0413b613204590806c29220c0fd35f22deafea5 | b7ddb84ae4f6c82cf60a182a1d3aeb78c30f3f69 | zhuyijie88/git_demo | /show3d.py | Python | py | 4,562 | no_license | '''
##zhyijie 2018/9/28
The default behavior is to visualize the points as white dots
>>>show3d.showpoints(np.random.rand(10000,3))
Control:
key q: quit
key Q: sys.exit(0)
key n: zoom in
key m: zoom out
key s: save screenshot to 'show3d.png'
Mouse: rotate
You can also play a video by specifying waittime
... |
cb2cb51cec3193d31d12ee90a6d19051c3f2f477 | 091b092ebf825a69e61364b2f0502b38912d1e27 | stardustzoe/Tensorflow | /1.Cnn_Captcha/deepFace.py | Python | py | 5,495 | permissive | import tensorflow as tf
import tensorflow.contrib.slim as slim
import numpy as np
from scipy.misc import imread
import os
HEIGHT = 280
WEIGHT = 200
RGB = 3
TRAIN_NUM = 23
x = tf.placeholder(tf.float32, [None, None, HEIGHT, WEIGHT, RGB], name="x")
y = tf.placeholder(tf.float32, [None, 2])
global_steps = tf.Variable(0... |
52eb2c903e985d3bec9054aba88a4a80e094f3f9 | 7cdef1d0158f0f341fded4a2257103d53484e87e | sietse93/Thesis | /Presentation_Results_Scenario1_Vo_V2.py | Python | py | 14,976 | no_license | from class_ScenarioLocationPerformance import *
from main_InspectData import DirName, InspectJsonFileInDir
from matplotlib import pyplot as plt
from matplotlib.lines import Line2D
import numpy as np
import pdb
# Goal is to get the data without the complicated loop structure.
# then we can get the scatter plots in ther... |
d8b18169ee6025127045c7ea60bc38a230207c8d | 0a72e71d7243bdb3d36db26a25dc1381b5501beb | Carlosfrancog/Scripts-Python | /desafio066.py | Python | py | 320 | no_license | from time import sleep
print('====== DESAFIO 066 ======')
print('-='*15)
print('Digite [ 999 ] para parar.')
print('-='*15)
sleep(1)
n = s = c = 0
while True:
n = int(input('Digite um número: '))
if n == 999:
break
c += 1
s += n
print(f'Você digitou {c} números, e a soma entre eles é {s}.')
|
3845f2413d257565af1b87abc9dfb39e7eb0e4ee | 4224e25921c199ede9aaed41bd5d72c7ef646bee | 1019350030wfj/python_demo | /spyder/baidutieba.py | Python | py | 3,030 | no_license | # -*- coding:utf-8 -*-
import requests
from bs4 import BeautifulSoup
# 获取网页的内容
def get_html(url):
try:
r = requests.get(url, timeout=30)
r.raise_for_status()
r.encoding = "utf-8"
return r.text
except:
return "ERROR"
def get_content(url):
'''
分析贴吧的网页文件,整理信息,保... |
cbf406786c0a25b2cd192cc4e6e377614cf3a911 | bd449e44acbb591b5ae8b41511f428fac8bc2b6c | VanChengkai/seeking-micro-influencers-for-brand-promotion | /code/mir_concat.py | Python | py | 16,465 | no_license | import tensorflow as tf
import os
import time
import xlrd
from six.moves import xrange
import numpy as np
in_vector_size=2
brand_vector_size=2
labels_vector_size=1
batch_size=64
text_size=300
pic_size=25088
text_layer1_size=300
text_layer4_size=512
pic_layer1_size=4096
pic_layer4_size=512
model_pa... |
c48c2c32cb42bee657453ee42c44cd945123c317 | 37ec0582b3e4fd8a473ae62563b36a41be0f6be0 | jliszka/fp | /taxes.py | Python | py | 1,227 | no_license |
class IncomeTax(object):
def __init__(self, name, brackets, rates):
self.name = name
self.brackets = brackets
self.rates = rates
self.taxes = []
def tax(self, total, marginal):
tax = 0
taxed = total * 12
left_to_tax = marginal * 12
i = 0
while left_to_tax > 0:
if taxed < self.brackets[i]:
a... |
904d36d1e1b7fe86cc41472f3bd82fc9f69e7438 | b3daba5eb5e59ae8a1fe4e1ff74ac9d85ea76c8a | tbfungeek/algorithm | /Python/DataStruct/Graphic/Shortest Path/Bellman-Ford.py | Python | py | 1,552 | no_license | #from https://www.geeksforgeeks.org/bellman-ford-algorithm-dp-23/
import sys
class Graph(object):
def __init__(self):
self.edges = []
self.vertexs = []
def add_edge(self, start, end, weight):
#添加边数据
self.edges.append([start, end, weight])
#如果还没存储过则添加到结点数组中
... |
9b7d951a302b5d4f6d79b829b5986e85d934ac95 | 17b4be4f12dadad836cb05ee49e5b414b42f461b | atlassian/sentry | /src/sentry/api/endpoints/user_details.py | Python | py | 3,161 | permissive | from __future__ import absolute_import
from django.conf import settings
from rest_framework import serializers, status
from rest_framework.response import Response
from sentry.api.bases.user import UserEndpoint
from sentry.api.serializers import serialize
from sentry.api.serializers.models.user import DetailedUserSer... |
5ac045ccba2a24c1fd2b6a3f0c61d8102d7d9aa0 | e35bc2e20ec2464a7488d57ce42c605f6c4b4985 | JeffersonCarvalh0/encargos-e-necessidades-docentes | /sistema/crud/migrations/0016_activity_short_name.py | Python | py | 530 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-01-22 20:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crud', '0015_auto_20180122_1644'),
]
operations = [
migrations.AddField(
... |
79b9a22381b89f18dbdd0b094a754db8e0e3392c | 117f00dbceddb68feec4e991cb67640eb30e5b80 | maloMal/virtualShopper | /projectEnv/Scripts/painter.py | Python | py | 2,164 | no_license | #!c:\users\mal\desktop\projects\groupproject\projectenv\scripts\python.exe
#
# The Python Imaging Library
# $Id$
#
# this demo script illustrates pasting into an already displayed
# photoimage. note that the current version of Tk updates the whole
# image every time we paste, so to get decent performance, we split
# t... |
d4ce4747a50acdabb81d67c19b296801e7640998 | 884e2980f3defd604938feb32e8fa20f87fde4b5 | Emily-chiu/Kata | /String_transformer.py | Python | py | 1,853 | no_license | # Given a string, return a new string that has transformed based on the input:
# Change case of every character, ie. lower case to upper case, upper case to lower case.
# Reverse the order of words from the input.
# Note: You will have to handle multiple spaces, and leading/trailing spaces.
# test.assert_equals(strin... |
a4d35c163ab87119a623fb91f8e1f33c8438cf41 | 9908ea45931ad0cd8590f64e6956e6ae20285daa | afettouhi/AutomatetheBoringStuffwithPython-py38 | /Chapter 8/extendingtheMulticlipboard.py | Python | py | 1,361 | no_license | #!/usr/bin/env python3
import shelve
import sys
import pyperclip
mcb_shelf = shelve.open('/home/af/Dokumenter/Programs/AutomatetheBoringStuffwithPython-py38/data/mcb')
# Save the clipboard contents to keyword
if len(sys.argv) == 3 and sys.argv[1].lower() == 'save':
mcb_shelf[sys.argv[2]] = pyperclip.paste()
... |
7dde8d765721a09036484a12d4deca96b43f1d44 | d63a175d2416f9e07262a270761febebd1d00f48 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_155/2633.py | Python | py | 265 | no_license | T = input()
for t in range(T):
val = 0
num = 0
smax, nums = raw_input().split()
smax = int(smax)
for s in range(smax+1):
d = s-num if s>num else 0
val += d
num += d + int(nums[s])
print "Case #%d: %d"%(t+1, val)
|
fe53d01286d2fabaa63329c91b9cf99546a8e4a5 | e9f6c14bb8e02aa8469f2cafb8aa0bb5ae1d2c8d | mina0502/Project | /WebPrograminig_Py/Web_ex28/change_ex28.py | Python | py | 1,741 | no_license | from flask import *
import sqlite3
DATABASE = 'my.db'
SECERET_KEY='development key'
USERNAME = 'root'
PASSWORD='1234'
def connect_db():
return sqlite3.connect(app.config['DATABASE'])
def createTable(g):
try:
sql = "create table if not exists student(name text, age int)"
g.db... |
f28259d722bf412070616e8162666ba1fad40e3d | 66158df21a6466898b6c7b24bd19a3cc2deef88c | coca1ne/bandit | /examples/sql_statements.py | Python | py | 1,210 | permissive | import sqlalchemy
# bad
query = "SELECT * FROM foo WHERE id = '%s'" % identifier
query = "INSERT INTO foo VALUES ('a', 'b', '%s')" % value
query = "DELETE FROM foo WHERE id = '%s'" % identifier
query = "UPDATE foo SET value = 'b' WHERE id = '%s'" % identifier
# bad
cur.execute("SELECT * FROM foo WHERE id = '%s'" % id... |
2261c4cbb25dc838078d5c88403410a733cbf00c | 0c119d5f4f1fbb2d04d53d7d8c5956e81d2c1c19 | por964/PythonHandin2 | /modules/week7.py | Python | py | 3,700 | no_license |
import urllib.request
from selenium import webdriver
import bs4
import re
import matplotlib.pyplot as plt
import pandas as pd
edc_url = 'https://www.edc.dk'
def edc_interaction(municipal):
browser = webdriver.Chrome()
browser.get(edc_url)
browser.implicitly_wait(5)
# Accepts cookies:
button_coo... |
4928e66b356c10b047a72662f4ec0b1df2b8756b | d8c4d0c041c36e731bebfe774dd1d27a4905dd14 | Marta6/Cerebellum-Simulation | /example.py | Python | py | 2,247 | no_license | import auxiliary_functions as aux
import nest
import nest.voltage_trace
import nest.raster_plot
import pylab as pl
import numpy as np
from matplotlib.pylab import *
g = 7.1
eta = 45.0
delay = 1.5
V_th = 30.0 # [mV]
N_E = 4000 # [Sahasranamam et al, NatSciRep, 2016]; all RS
N_I = 1000
F = 0.8 # Fra... |
9a220320aba6762701f3e614849d1b0a72b49e7e | f8c97305f62fb87831e94b70418e1cd06d2096de | Thomas1981Lang/SmartNinja-SWD1-Homework_9.1-9.3_inkl._Bonus-joining_strings_-_CAPM_Homework | /homework_9-Bonus.py | Python | py | 486 | no_license | str_one = 'Happy'
str_two = 'Day'
print(str_one + str_two + ' is the same as {}{}'.format(str_one, str_two))
print('')
print('')
print(str_one + ' ' + str_two + ' is the same as {} {}'.format(str_one, str_two))
print('')
print('')
print('%s %s ' % (str_one, str_two) + 'is the same as {1} {0}'.format(str_two, str_o... |
38e9d7fa887e7e0b30e0416790f4f0ef7bc4c3ae | 4aa622c5620cb7e38a045332d54f80c2721d72de | lummish/cmsi282 | /homework4/best_path.py | Python | py | 1,475 | no_license | from prims import Graph, Node
import sys, getopt
def main(argv):
try:
g = Graph()
graph_string = str(argv[0])
edge_array = graph_string.split('|')
for e in edge_array:
e_parsed = e.split(',')
g.add_edge(e_parsed[2], e_parsed[1], e_parsed[0])
shortest = {}
best = {}
node_set = g.get_nodes()
... |
d3fd8095f22ac00c5a3cf4025895dbe1dc3ac19b | 7fff17f55e61d519018822fbe3fa4af4446af39b | Lonewolf-Information-systems/owtf | /owtf/plugins/web/passive/Testing_for_SSI_Injection@OWTF-DV-009.py | Python | py | 463 | permissive | """
PASSIVE Plugin for Testing_for_SSI_Injection@OWASP-DV-009
"""
from owtf.dependency_management.dependency_resolver import ServiceLocator
DESCRIPTION = "Searching for pages that are susceptible to SSI-Injection"
def run(PluginInfo):
resource = ServiceLocator.get_component("resource").get_resources('PassiveSS... |
129f810f2168257c18207d6b07672c15e42aa588 | e92c95b1cb3bb7c0887e4dec94e43a7690d22377 | salmanchik1/Project_Euler | /39.py | Python | py | 980 | no_license | # This program is written in Python 3.7
num = 1000
# The maximal sum
squares = [i**2 for i in range(1, num // 2)]
# The length of the hypotenuse can't be larger than a half of a sum
sums = [0 for i in range(num)]
# Create the list filled by the zeros for each of the numbers
for i in range(3, num // 2 + 1):
for c1 i... |
be5cdb3ed4015e551e8c2016c6572514bd4995dc | 57949a2949a22d1ce1d7b0c98ff5691d198fcbd0 | Yanzhaowei/mxonline | /apps/courses/migrations/0001_initial.py | Python | py | 4,587 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2018-02-12 09:12
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('organization', '0001_ini... |
95ff9b45ad9f9f6646cc735a4d15fd7ab365cf2a | 776c6cb29d12c7194c767c4a3125181c868e9cbe | akhr1997/TShirtEcom | /ecom/api/user/migrations/0001_initial.py | Python | py | 2,938 | no_license | # Generated by Django 3.0.8 on 2021-06-05 18:47
import django.contrib.auth.models
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
]
operations = [
... |
0b522f8c8b49a1baeff9e58dbf26cc2a324445b1 | 77ae5c862cdb094d2eae40e0f53a91816325bdd1 | TAM-Lab/TAMRepository | /Entity_Linking/hsm/data_processing/awiki_process.py | Python | py | 46,801 | no_license | """
2021-3-28
wikipedia data process
"""
import os
import csv
import json
import pandas as pd
from collections import defaultdict
from bs4 import BeautifulSoup
from tqdm import tqdm
import copy
# 1. 先将文本中所有gold_id值不在enwik里的采用爬虫方式进行补充
def applement_missing_gold_id(missing_gold_ids, missing_gold_title):
# 填补缺失的gold... |
d7e234c75091239eb985814e940164de89214ccb | eb3ba5b2e33a40b32f80745fdb52c76ccfa3746e | neelamy/Algorithm | /DP/Ugly_number.py | Python | py | 1,091 | no_license | # Source : http://www.geeksforgeeks.org/ugly-numbers/
# Algo/DS : DP
# Complexity :O(n)
# Python program to find n'th Ugly number
# Function to get the nth ugly number
def getNthUglyNo(n):
ugly = [0] * n # To store ugly numbers
# 1 is the first ugly number
ugly[0] = 1
# i2, i3, i5 will indicate indices for 2... |
cea54f50e043651e183b95d57b8a04d4dc061152 | ad96150516c5a182114f4606b1f939d9907af8e7 | zaoyuaner/axf_vue | /back_axf/goods/serializers.py | Python | py | 1,008 | no_license | from goods.models import MainWheel, MainNav, MainMustBuy, MainShop, MainShow, FoodType, Goods
from rest_framework import serializers
class MainWheelSerializer(serializers.ModelSerializer):
class Meta:
model = MainWheel
fields = '__all__'
class MainNavSerializer(serializers.ModelSerializer):
... |
08bdbd95b894708c9767d6d6406553feff55946a | b94f0dca87b1e3169d7ab54f920c9a0ba9b34301 | VIJAYAYERUVA/BestBuddy | /Sourcecode/Final_Project_Package/BestBuddy/UI.py | Python | py | 3,405 | permissive | import pymongo
from pymongo import MongoClient
import pprint
import datetime
client = MongoClient('mongodb://VIJAYAYERUVA:VIJAYAYERUVA@ds123361.mlab.com:23361/restapi')
db = client.restapi
collection = db.BESTBUDDY
for doc in collection.find():
text = str(doc['text'])
import tensorflow as tf
import numpy as np
im... |
f5715d5c993203f26350a305957e3b01e5a96021 | b73c178d9584fb24f4cf58e70495848088b31a86 | Symfomany/keras | /.history/tf_regression_logistic_20181129223436.py | Python | py | 5,393 | no_license | import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
import os, argparse
"""
Any interaction with your filesystem to save persistent data in TF needs a Saver object and a Session object.
The Saver constructor allows you to control many things among which 1 is important:
The var_list: Default to... |
d830b75b8d5820008569f018b686f1c4cf7aa556 | ce8312b3db46c74928cb55622fcfa7a50e331160 | hpatel1567/pymatgen | /pymatgen/io/xr.py | Python | py | 6,251 | permissive | # Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module provides input and output mechanisms
for the xr file format, which is a modified CSSR
file format and, for example, used in GULP.
In particular, the module makes it easy
to remove shell positions from relaxatio... |
4bbcd98d960bb81a3bb1f840746978e32afc7462 | 28abe6404f54134f24203ae8cae102df02a49d02 | sysadmin777/BrightHorizon | /BrightHorizon/main/models.py | Python | py | 1,322 | no_license | from django.db import models
import datetime
# Create your models here.
#Graduation, Certification, Get a Job
#12 credits, 24 credits, 36 credits, done (GPA 3.7+ = bonus points)
#take practice exam and pass, pass exam (bonus task take online class)
#Meet career counsoler, build portfolio, get interview, get hired
#Ea... |
d8a70d033d72fbab559083ed907ea8ff3ba2d822 | 4e3228cd41b1d08c1164ef984cf5b41570fbd54c | BCHoagland/RL-Utils | /rl_utils/trainer.py | Python | py | 9,341 | no_license | import os
from copy import deepcopy
from visdom import Visdom
import numpy as np
import gym, gym.spaces
import gym_service
import torch
import torch.nn as nn
import torch.optim as optim
from baselines.common.vec_env.subproc_vec_env import SubprocVecEnv
from rl_utils.model import Policy
from rl_utils.storage import R... |
5bdc4959b862e43ca43a56f5080bce67c15789b8 | 498c031ffa3a94f8a524f30815c202d3c4788625 | DanielLizardo12/python-practices | /Basics/2 strings.py | Python | py | 1,447 | no_license | # STRINGS
# Basics-------------
my_string = "abcdefg"
# Indexing--------------------------------------------------------------------------------------
print(my_string[3]) # Index in Python starts at position 0 so position 3 will be the 4th element
print(my_string[-1]) # Index -1 is the last position in arrays
# Slic... |
97c805634550e138625ac2749448b77e51f4bc39 | ac58b9f60073df0cc75a535978a98a62f2ac5f20 | yilmazbaysal/django-cassandra-engine | /testproject/model_meta/tests/tests.py | Python | py | 8,715 | permissive | from unittest import skipIf
import django
from django.apps import apps
from django.contrib.contenttypes.fields import GenericForeignKey
from django.core.exceptions import FieldDoesNotExist
from django.db.models.fields import Field
from django.db.models.options import IMMUTABLE_WARNING
from django.test import SimpleTes... |
aa1b0132197dc67ed166c63bcbc2c39cb5e349ad | 384689542a7784abf6b2aa4821a8266ae88b841c | manjot-baj/My_Python_Django | /HSM/hsm/attendance.py | Python | py | 1,399 | no_license | from .models import BaseModel
from django.db import models
class Job(BaseModel):
name = models.CharField(max_length=50, null=True, blank=False)
description = models.CharField(max_length=50, null=True, blank=True)
def __str__(self):
return self.name
class SocietyEmployeeDetail(BaseModel):
soc... |
64b9664b83fc52b506e4b696a46f90d56d758c6a | 4abbad2a7d4c776ddbc6c0ca282fb86f1450a8ec | akashsinha/zamboni | /apps/blocklist/tests.py | Python | py | 18,538 | no_license | import base64
from datetime import datetime
from xml.dom import minidom
from django.conf import settings
from django.core.cache import cache
from nose.tools import eq_
import amo
import amo.tests
from amo.urlresolvers import reverse
from .models import (BlocklistApp, BlocklistCA, BlocklistDetail,
... |
62df9ae4061497c0fc63bc4c79f8d246230b0a27 | d953d8315c491d4bc31ebfadac20b0b70fe2f527 | dobreandrei1/legal | /server/.history/server_20200307213707.py | Python | py | 1,708 | no_license | from pathlib import Path
from flask import Flask, render_template, request, send_file, send_from_directory, safe_join, abort, current_app
# from werkzeug import secure_filename
import pandas as pd
import os
import time
import json
from flask_cors import CORS
from haikunator import Haikunator
import unidecode
import PyP... |
f819d56509d500a8b91c29c1a327d4edadadc3b8 | 68b39a99745e41966d66dba489db6c67b29f0ab5 | defep/scrapy-news | /spiders/infobae.py | Python | py | 460 | no_license | # -*- coding: utf-8 -*-
import scrapy
from items import Article
class InfobaeSpider(scrapy.Spider):
name = 'infobae'
start_urls = ['https://www.infobae.com']
def parse(self, response):
for el in response.css('.headline'):
url = response.url + el.css('a').attrib['href']
ar... |
83b25b63a0f48448b7d9821c3b1e5a230153e93d | c19a5c1bb5d00de5714514d626bf54ac1ede35d4 | coinkite/connectrum | /connectrum/findall.py | Python | py | 4,527 | permissive | #!/usr/bin/env python3
#
#
import bottom, random, time, asyncio
from .svr_info import ServerInfo
import logging
logger = logging.getLogger('connectrum')
class IrcListener(bottom.Client):
def __init__(self, irc_nickname=None, irc_password=None, ssl=True):
self.my_nick = irc_nickname or 'XC%d' % random.ran... |
8ef0e99df36fdd5274c6c268510dfd3ee96be53a | 1e371829e8084129468c03a20c55eea92ce09125 | rifkegribenes/python-rest-api-system-testing | /tests/system/user_test.py | Python | py | 1,461 | no_license | from models.user import UserModel
from tests.base_test import BaseTest
import json
class UserTest(BaseTest):
def test_register_user(self):
with self.app() as c:
with self.app_context():
r = c.post('/register', data={'username': 'test', 'password': '1234'})
self... |
2e5d02fc2b50ec7bd38c09799db5c2f8a83704de | 931febda60714601f56e313a5cbc8c2038fa7f6d | agb91/ImageRecognitionClustering | /CrossVal/provaGetImgPath.py | Python | py | 972 | permissive | import sys
sys.path.insert(0, "./Scripts")
import funzioniDB as fdb
import cv2
import numpy as np
MSG_INPUT = "Inserisci un ID (per questo esempio, inserire un ID compreso tra 146 e 168): "
MSG_ERRORE_k_BASSO = "Errore: inserire un ID maggiore o uguale a 0"
MSG_ERRORE_NO_INT = "Non e' stato inserito un numero intero, ... |
1331a5e26a2fc368ae422e5ab538a67b994168f1 | 9c52e3669e9500636181b12204add26564dd68fc | donasaur/hiv-model | /tests/test_Translation.py | Python | py | 7,848 | permissive | from process.Translation import *
from mainaux.TestHelpers import *
from state.Proteins import *
import unittest
import numpy as np
class TestTranslation(unittest.TestCase):
# This method is run prior to each test automatically.
def setUp(self):
# Default state
self.state = State()
... |
910dd3d6cf07f4684d537cfae3f58e179e02a056 | a720f6e06f609c7f9365bcbe83af0249eefcdae1 | Joy327/greedy_layerwise_pretrain | /cross_model_second.py | Python | py | 1,706 | no_license | import tensorflow as tf
import numpy as np
learning_rate = 0.01
iteration = 600
data_set = np.load('second.npy')
def normalize(train):
min,max = train.min(),train.max()
train = (train-min)/(max-min)
return train
data_set = normalize(data_set)
input_second = tf.placeholder(tf.float32,[None,256,256,3])
wit... |
279c3d65f55e39604f0b820b3caa6f2ad38e9964 | 972f182f7c150c1dc14c8f97f52ecb6e3ec18d4d | Tochi-Nwachukwu/django_news_api | /news_app/news/migrations/0006_alter_news_image_links.py | Python | py | 411 | no_license | # Generated by Django 3.2.5 on 2021-07-19 10:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('news', '0005_alter_news_headline'),
]
operations = [
migrations.AlterField(
model_name='news',
name='image_links',
... |
7beb71644c43e1064c3045cfe181bfd317773226 | facccc4ddc13c965643c8714d39f50dba71eb556 | jchen42703/keras_med_io | /keras_med_io/utils/misc_utils.py | Python | py | 5,396 | permissive | import os
import numpy as np
import nibabel as nib
import pandas as pd
def get_multi_class_labels(data, n_labels, labels=None, remove_background = False):
"""
One-hot encodes a segmentation label.
Args:
data: numpy array containing the label map with shape: (n_samples,..., 1).
n_labels: num... |
0ceb431995c8910a4fd647d2d3bc5635227a36aa | ba211266118d21cc39ec6978994ca13733f68750 | humkanet/robymex | /robymex/connectors/binance.py | Python | py | 2,214 | no_license | from .websocket import WebsocketConnector
from .http import HttpConnector
from ..primitives import Symbol, Trade, Side
from decimal import Decimal
from typing import List
import asyncio
import aiohttp
import websockets
try:
import ujson as json
except ModuleNotFoundError:
import json # type: igno... |
f4f7454811471167a7e9eac228ec3cd21a5c92e2 | d1f477043db45a6efcaf958ccad18e014c5ae769 | guialfredo/vision | /references/detection/coco_eval.py | Python | py | 12,029 | permissive | import json
import numpy as np
import copy
import torch
import torch._six
from pycocotools.cocoeval import COCOeval
from pycocotools.coco import COCO
import pycocotools.mask as mask_util
from collections import defaultdict
import utils
class CocoEvaluator(object):
def __init__(self, coco_gt, iou_types):
... |
7d2c8a5d39238717b1cd4f4818133d712326c8fc | 3d950b22c8c512e620e5b61405e2714f7b176c6d | wild-radio/embarcados | /lsusb.py | Python | py | 979 | no_license | import subprocess
lsusb = subprocess.check_output(["lsusb"])
ls_dev = subprocess.check_output(["ls", "/dev"])
cam1_dev = None
cam2_dev = None
cam1_index = None
cam2_index = None
dev_ids = []
for line in ls_dev.splitlines():
if "video" in line:
dev_ids.append(int(line[-1]))
dev_ids.sort()
for line in lsu... |
757015e0843cb0f93df6f9500008635e48dd43b2 | 187bcc2efe5aec295dd73d94e1ded18e14c7e8b3 | jlawrenc/LongExerciseTopMass | /fitNcalibrate/PolyFit/polyFitPeak_m175p5.py | Python | py | 7,801 | no_license | #!/usr/bin/env python
import math, ROOT, json, optparse, os, sys, pprint
from ROOT import *
import tdrstyle
def myFitFunc(x=None,par=None):
return par[4]*(par[0]+par[1]*(x[0]-par[2])*(x[0]-par[3])**2)
def Calc(a, b, c, xmax,d,e,f):
first = -(math.sqrt(b**2-3*a*c)+b)/(3*c)
second = (math.sqrt(b**2-3*a*c)-b... |
35997bc1f8bf76115e552b6affeb2f1893176ad1 | 2d21def0bbda741c344ba8007aa506e062b4d973 | basirshariat/PAIRpred | /codebase/pairpred/experiment.py | Python | py | 8,870 | no_license | from datetime import datetime
from numpy import ndarray
import cPickle
from numpy.random import mtrand
import math
from PyML import SVM
from PyML.evaluators.assess import cvFromFolds
from PyML.evaluators.roc import plotROCs
from enum import Enum
from codebase.constants import reports_directory
from codebase.data.dbd4... |
8f19c06bf33a94aa384225a928538b272561d927 | ea7e1a86c710b9de79b41b69485dbe47c88eb962 | ande897b/FLoatLayoutTest | /venv/Scripts/pip3.7-script.py | Python | py | 425 | no_license | #!C:\Users\Ander\PycharmProjects\FLoatLayoutTest\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==19.0.3','console_scripts','pip3.7'
__requires__ = 'pip==19.0.3'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '',... |
375a7cb8d63c6dba073e69c063d3c3dc7f8ce0c3 | 5b2cdba21a12b0326cda890b8f603f1a5b568b46 | Mibokess/teaching-assistant-evaluation | /backend/settings/authentication.py | Python | py | 1,690 | permissive | import people_pb2
import people_pb2_grpc
import grpc
import urllib
import os
from django.contrib.auth.models import User
class MyBackend:
def __init__(self):
API_SERVER = os.environ["RUNTIME_SERVIS_PEOPLE_API_SERVER"]
API_PORT = os.environ["RUNTIME_SERVIS_PEOPLE_API_PORT"]
API_KEY = os.env... |
0089d9b08648e16555c76b3c9c10440f9d957187 | 6f1e9bc66a569ba0ec8e433eb653c26ec1cf8445 | junseok-0505/Algorithm | /이코테/그리드/이코테 실습 1-1.py | Python | py | 581 | no_license | # 이코테 part 3 1-1.
n = int(input())
data = list(map(int, input().split()))
data.sort()
result = 0 # 총 그룹 수
count = 0 # 현재 그룹에 포함된 모험가의 수
for i in data: # 공포도를 낮은 것부터 하나씩 확인하며
count += 1 # 현재 그룹에 해당하는 모험가를 포함
if count >= i: # 현재 그룹에 포함된 모험가의 수가 현재의 공포도 이상이면,
result += 1 # 총 그룹 수 증가
... |
490329e71b778b187155096878c0eb1d91d9ebf7 | 593dd06cfcea9a5f2a2c8dc74e847bca90a9f885 | AndreMessi/udemypythonbeginer | /lesson05.py | Python | py | 303 | no_license | #tipe daya string in python
a = 'hello my name is andre putra i am happy learning python'
print (a)
print (type(a))
print (a[0:6])
print (a[9:22])
print (len(a))
print (a*2)
print (a.strip())
print (a.lstrip())
print (a.rstrip())
print (a.find("python"))
print (a.replace("python","machine learning")) |
10f809ecc0ef804079ea8ea0553392ac3f5c581b | 772080738978c1eb80c3bd6334294d6ec02c8ebd | rduvalwa5/OReillyPy | /PythonHomeWork/Py2/Py2_Lessons/src/leasson8project.py | Python | py | 2,691 | no_license | '''
Created on Jan 13, 2013
Lesson 8, Project 1
Here are your instructions:
Write a GUI-based program to build a window layout as shown below. When the frame is resized, the buttons should stay the same height
and expand sideways. Frame 1 and Frame 2 should always be the same height and width as each other, and Frame... |
44be4caaee70f46ae4eeaf197a5043a3f5103f97 | 8de56f259ed0f3215c520cec091e225db9ee2289 | grie601/test_restaurant | /menu/migrations/0003_auto_20180216_2120.py | Python | py | 454 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2018-02-16 16:20
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('menu', '0002_auto_20180216_1501'),
]
operations = [
migrations.RemoveField(
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.