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
5162f5acf8fe294e9537a2c7c1431ff27d8fdd71
7480464024d05e39cc00d6eae0b576edc55d7699
lontivero/pytor
/pytor/utils.py
Python
py
3,580
permissive
# Copyright 2019 James Brown # # 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, ...
317a840fa1e03372e5584d5b7181b4d555b2fc5b
8094b4d516512dcdafa65dd34a5c0d252c3fb98b
summerghw/pyQUILTS
/quilts.py
Python
py
106,533
no_license
''' quilts.py Remaking QUILTS in Python. It's in its early stages, so half the lines are just me asking myself questions that I will forget to answer in the future. Also, trying to be super meticulous about checking input for correctness/existence. Hold me to this in the future when I start to get lazy. A possible ...
76718aabf05029ec563122e946f1907c60d91c42
3471a3f7dd59c041cbab58b6f42ff40ffe27bb94
ftk-ntq/vpp
/test/test_punt.py
Python
py
41,613
permissive
#!/usr/bin/env python3 import binascii import random import socket import os import threading import struct import copy import fcntl import time from struct import unpack, unpack_from try: import unittest2 as unittest except ImportError: import unittest from util import ppp, ppc from re import compile import...
ccf6b646f18b9504c9174df11287fe581ca91085
b6ce1dad15576e6bc3282cba6774017d16edc4ae
HalfBuddhist/Python2Syntax
/multiprocessing_t/terminate_sub_process.py
Python
py
2,212
no_license
#!/usr/bin/env python # coding=utf-8 # # Copyright (c) 2009 IW. # All rights reserved. # # Author: liuqw <liuqingwei@chuangxin.com> # Date: 2018/9/7 """Terminate the sub process. method 1: sub_process.terminate. method 2: os.kill(pid, sig_kill/sig_term) method 3: sig.alarm to nofify the sub procees to exit ...
f6057ecdb32a6cdebd98df9e63e022d593954d5a
3c48600ef90fa05d0870aa68d983c84aa2c006f3
carbonatedcaffeine/zircon-rpi
/scripts/gn/trim_visibility.py
Python
py
4,531
permissive
#!/usr/bin/env python3 # Copyright 2019 The Fuchsia Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Example usage: $ fx set ... $ scripts/gn/trim_visibility.py --target="//build/config:Wno-conversion" The output is useful for insta...
bf2a8b84805530440890007b459163def7e0f5e8
e847c78849baf0435920aa8d7f95e290c361a699
XiXiRuPan/dxda
/utils.py
Python
py
2,791
permissive
from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import numpy as np #import matplotlib.pyplot as plt #from mpl_toolkits.axes_grid1 import ImageGrid # Model construction utilities below adapted from # https://www.tensorflow.org/version...
eb73b07b1b7192ce9f57a9248a14f159d3e24d2f
59c3e0263441b83dd252e30fbb80e8044f455d00
alkcode/django-Tienda
/tienda_online/urls.py
Python
py
755
no_license
"""tienda_online URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class...
5daa1e4d5f822811688019d2dc87d1cfcbecddb8
fe199fcad613dda129b973565f6b5dd6b1f3acc9
devopszone/sensu_st2_backup
/stackstrom/mistral/lib/python2.7/site-packages/keystonemiddleware/tests/unit/client_fixtures.py
Python
py
24,925
no_license
# Copyright 2013 OpenStack Foundation # # 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...
9ed09968c8e63a13b0c40da5a558b3290c7b775c
93193916c9532fa2688328f9764dfaed7ea07dce
ninjakamushek/project
/menu.py
Python
py
28,704
no_license
import sys import pygame import os import copy pygame.init() new_game_button = 'new' records_button = 'records' music = pygame.mixer.music.load('music.mp3') pygame.mixer.music.play(-1) # classes for wall block, point balls, boosting balls class Wall(pygame.sprite.Sprite): def __init__(self, x, y): super()...
e45e4076abaa7a9c144b7b9d13e751b6347fa35f
8767c693126dab09ac8ad83a07c7d9cd3a2dd8f8
Eurus-Holmes/nni
/nni/nas/space/frozen.py
Python
py
1,438
permissive
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. __all__ = ['current_model', 'model_context'] import copy from typing import Optional from nni.mutable import frozen_context, Sample def current_model() -> Optional[Sample]: """Get the current model sample in :func:`model_context`. The...
45b41bb2afdcb3d49a112bd61d9f89f951d250e0
55b995d86ebd61da651a2a4fba2472a9c96873ef
geekmc/pyre-check
/client/commands/v2/persistent.py
Python
py
34,993
permissive
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import asyncio import dataclasses import enum import json import logging import os import subprocess import tempfile import traceback from pat...
9fb884b96acf4192f8652bbf577bbec6d3820fdf
8a0d046a91c29c6d0e76da48042a637b56092dc1
amos1994/python_games
/stopwatch.py
Python
py
2,732
no_license
# Mini-project - "Stopwatch: The Game" # Angel Inokon # 11/16/12 # Test your reflexes by building a digital stopwatch that tracks the time # using the timer, canvas drawing, and "Start", "Stop" and "Reset" buttons. Code Skulptor http://www.codeskulptor.org/#user5-vKATfaW5W3-3.py import simplegui # de...
825e0c0902c88d4d241798a3a81b1dc4e3f31ec3
5e781a8b5d23d1fce9793d10d5f9eb3b8526cbd2
samgclarke/fish-post
/application.py
Python
py
374
no_license
#!/usr/bin/env python from flask.ext.mongoengine import MongoEngine from config import app import os app.secret_key = 'teddymonkey' # wrap app in mongengine db = MongoEngine(app) if __name__ == '__main__': # Bind to PORT if defined, otherwise default to 5000. port = int(os.environ.get('PORT', 5000)) app...
510f651a4cb86bb8931fadebf3645a7ec1b5727e
76eabc0f815ab9cc112ceaa2b36b9ca2d6dd5bde
StephenSchroeder/trio
/notes-to-self/blocking-read-hack.py
Python
py
1,449
permissive
import trio import os import socket import errno bad_socket = socket.socket() class BlockingReadTimeoutError(Exception): pass async def blocking_read_with_timeout(fd, count, timeout): print("reading from fd", fd) cancel_requested = False async def kill_it_after_timeout(new_fd): print("sleepi...
8bfa79e82d40900a5997ce417c8ac20c5dde5d4f
1de4de051ed9886318c3a43e4a87868aaa951f2c
Lyz1213/msc_dissertation
/NLG/opts.py
Python
py
13,345
no_license
import argparse def model_opts(parser): """ These options are passed to the construction of the model. Be careful with these as they will be used during translation. """ # Model options # Embedding Options parser.add_argument('-word_vec_size', type=int, default=250, ...
742894d12674ca814bb63e063c0d11282b4454cc
34e81dd8c528d62cf2ef12b86aa26ea5e090e104
tdisbm/pythonexpress
/exercises/censure_filter.py
Python
py
1,164
no_license
banned_words = ['blin', 'Voldemort', 'Tom Riddle'] text = input("Enter text: ") # fast and greedy solution output_text = text for banned_word in banned_words: output_text = output_text.replace(banned_word, "*" * len(banned_word)) print("Result: " + output_text) # comparing with lower string output_text = text ou...
7aa3f2c306ed6dcd4eacbc40e3334d8edd0e0d2b
fbd80bb96ecfd017e6e39e1256099ca5a944645f
Ason93/Mask_RCNN_depth_confidence
/mrcnn/config.py
Python
py
8,805
no_license
""" Mask R-CNN Base Configurations class. Copyright (c) 2017 Matterport, Inc. Licensed under the MIT License (see LICENSE for details) Written by Waleed Abdulla """ import math import numpy as np # Base Configuration Class # Don't use this class directly. Instead, sub-class it and override # the configurations you ...
3c15369c209d4142a646daa6422f7f36f70d8a44
6f20e3096adc1d0ee30096a6dd761e039068e831
bobruk76/E9
/config.py
Python
py
334
permissive
import os class Config: SECRET_KEY = str(os.environ.get("SECRET_KEY",os.urandom(32))) PORT = os.getenv('PORT', 5000) SQLALCHEMY_DATABASE_URI = str(os.environ.get("DATABASE_URL", "postgresql://e9user:e9user@localhost:5432/e9")) SQLALCHEMY_TRACK_MODIFICAT...
0c70d0d89c036adcdf1f4e84b81a57c4a3022314
2b4dd4e854e7a1e6d736ff5a45b1c65611bec394
doyleSM/projeto2-ruffus
/usuarios/models.py
Python
py
2,560
no_license
from django.contrib.auth.models import AbstractUser from django.db import models from catalogo.models import Categoria class User(AbstractUser): is_cliente = models.BooleanField(default=False) is_prestador = models.BooleanField(default=False) class Endereco(models.Model): nome_rua = models.CharField('...
1c43298b127ee1f10a9f65b8c72a562bd2a78ac6
ad3a2479f74d98be15d97b0beb6f7729b12cbd51
mbalcerzak/county_covid_dashboard
/src/app.py
Python
py
3,968
permissive
from altair.vegalite.v4.api import concat import streamlit as st import json import pandas as pd import os @st.cache def get_locations_json(): with open("data/sample/locations_sample.json", "r") as f: return json.load(f) @st.cache def get_true_cases(): with open("data/sample/county_true_cases_sample.j...
455f8d85c0bacb24efc607ee634e76ab529acdd7
dd8ebfbe187c6ec531a50fc2ccdee043b9396574
bswartz/python-manilaclient
/manilaclient/utils.py
Python
py
7,962
permissive
import os import re import sys import uuid import prettytable from manilaclient import exceptions from manilaclient.openstack.common import strutils def arg(*args, **kwargs): """Decorator for CLI args.""" def _decorator(func): add_arg(func, *args, **kwargs) return func return _decorator ...
27d6cfb2ebd377bb4356a10a8c810efbc747d924
969d45c58010d242f6020f5f6b01b1dd3df907d9
Sarangc1203/DBMS-project-CSGO
/Submission/FRONT_END/map_data.py
Python
py
5,842
no_license
from PIL import Image maps = dict() # de_dust2 # StartX = -2486 # StartY = -1150 # EndX = 2127 # EndY = 3455 # ResX = 1024 # ResY = 1024 # SizeX = EndX - StartX # SizeY = EndY - StartY # maps['de_dust2'] = dict() # maps['de_dust2']['StartX'] = StartX # maps['de_dust2']['StartY'] = StartY # maps['de_dust2']['EndX'] ...
026ab8ed1dd12891c6123c94907db7a282c4ff0b
85bb5348c388c3a543363654f953b26551c57ba2
amankhandelia/datasets
/datasets/coached_conv_pref/coached_conv_pref.py
Python
py
6,888
permissive
# coding=utf-8 # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. # # 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/lice...
a21e3a73e68a5eaf7952b53bfaf4e90ddbfc1691
5e552a8368886405227db25ad491737cdd5aaf54
smart-on-fhir/client-py
/fhir-parser-resources/template-unittest.py
Python
py
2,297
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR {{ info.version }} on {{ info.date }}. # {{ info.year }}, SMART Health IT. import os import io import unittest import json from . import {{ class.module }} from .fhirdate import FHIRDate class {{ class.name }}Tests(unittest.TestCase): def i...
49c1bee8a93ff7d8ee731344884c6fe05db51adb
52b2e077c647d47f76820a5eb91b41715efafd3f
pkprzekwas/videophone
/tests/test_person.py
Python
py
487
no_license
import pytest def test_create_person(person, created_person_group): code, _, id = person.create(group_id=created_person_group, name='test_person') assert code == 200 def test_list_persons(person_group): code, body = person_group.list() assert code == 200 def test_delete_person(person, created_pers...
3ff8b7e537df6af4ae38a308d6e20d09c0c0dfa1
2a2bb37ad97a41fc0f1c8901d944fd1707897336
hoavt-54/nli-images
/models/old_models/eval_mt_model_hphi.py
Python
py
6,879
no_license
import atexit import csv import json import os import pickle import random from argparse import ArgumentParser import numpy as np import pandas as pd import tensorflow as tf from sklearn.metrics import accuracy_score from tl_mt_model import build_tl_mt_model_hphi from datasets import ImageReader, load_vte_dataset fro...
1512390e14eb1ae4d42297934f4686aa545acb24
44fef09f942089e5d09da1f08ae06b0a466761be
Chaurasiasagar01/news-please
/build/lib/newsplease/__main__.py
Python
py
22,057
permissive
import logging import shutil import signal import sys import threading import time from distutils.dir_util import copy_tree from subprocess import Popen import os import plac import psycopg2 from elasticsearch import Elasticsearch from scrapy.utils.log import configure_logging cur_path = os.path.dirname(os.path.realp...
01ce493ba3e87273933c64e8a5ccfe5b5152d23a
0ccebd6fbf7b7d446f6aec9612e1ed62ecb81488
kri5/pghoard
/test/test_common.py
Python
py
4,923
permissive
""" pghoard Copyright (c) 2015 Ohmu Ltd See LICENSE for details """ from .base import PGHoardTestCase from pghoard.common import ( create_pgpass_file, convert_pg_command_version_to_number, default_json_serialization, get_connection_info, json_encode, ) from pghoard.rohmu.compressor import snapp...
6ec23f96cfa2322f878e1ada29ddea7cd0e785eb
654b207723781c1b2d23591e944640644eed7ffd
hubaimaster/aws-interface
/aws_interface/cloud/schedule/delete_schedule.py
Python
py
1,087
permissive
from cloud.permission import Permission, NeedPermission from cloud.message.error import NO_SUCH_SCHEDULE # Define the input output format of the function. # This information is used when creating the *SDK*. info = { 'input_format': { 'schedule_name': 'str', }, 'output_format': { 'schedule_...
967b7dd7076d38cd95501f05e324136dc0866caa
4497aa5122e0ad08e1430d2c0c3a8246270726f5
virtualpeer/NeoFinRL
/trade.py
Python
py
7,701
permissive
from elegantrl.agent import * from elegantrl.run import * import torch from neo_finrl.data_processor import DataProcessor def trade(start_date, end_date, ticker_list, data_source, time_interval, technical_indicator_list, drl_lib, env, agent, mode='backtesting', if_vix = True, **kwargs): ...
8035656ac7dc3eba7b7b3494669361d469b2b428
0eb59b425542d348a86531c0c4021ad78c7e57a8
Vatavuk/timelessis-1
/tests/integration/it_tables_test.py
Python
py
2,262
no_license
""" @todo #234:30min Timeless ModelForm is not working properly, the Table form in test_create cannot be saved. The problem is that it does not pass form data parameters to model constructor properly. Parameters are passed through *args but ModelForm works uses **kwargs to instantiate model. Once this is fixed, rem...
3e44505e5d86faff660141cdb751d7259c6f20ae
fb1d04b091ae05f9246bff4d6bc18c40d828f6e5
marietti/MastersAI
/WebInterface/WebInterface/networkif/migrations/0004_auto_20210829_2101.py
Python
py
685
no_license
# Generated by Django 3.2.6 on 2021-08-30 04:01 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('networkif', '0003_networkif_timestamp'), ] operations = [ migrations.RemoveField( model_name='networkif', name='sens...
ef39a7f05ae79624a87b535992f356520020377f
cef9b400f3e41fd4ff83484d29d9836f39116752
ivanstewart2001/python_start
/P2.WebMapping/P2.map1.py
Python
py
1,075
no_license
import folium import pandas data = pandas.read_csv("Volcanoes.txt") lon = list(data["LON"]) lat = list(data["LAT"]) elev = list(data["ELEV"]) def color_producer(elevation): if elevation < 1000: return 'green' elif 1000 <= elevation < 3000: return 'orange' else: return...
814341e88ff7531ccd7b75c7cdd6f0c0fda55a37
c9cdcd2693bbcffc548477edc6e2878ecc6b1fdd
xmba15/miscellaneous
/python/standard_libraries/opencv/notebooks/canny_edge_detector.py
Python
py
5,930
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import cv2 import enum from scipy.ndimage.filters import convolve as convolveimg class THRESHOLD_PIXEL(enum.Enum): NON_RELEVANT = 0 STRONG = 1 WEAK = 2 class CannyEdgeDetector(object): def __init__(self, gray_img): assert gray_...
b9af107b62a931b0cff0c29af9326d8a751f45a9
679c80015286223c4eb9bd1de034934eaa27cc3c
ashmauro/cp1404practicals
/prac_06/guitars.py
Python
py
834
no_license
""" CP1404/CP5632 Practical - Client code to use the Guitar class. """ from prac_06.guitar import Guitar def main(): """Get guitar info.""" guitars = [] print("My guitars!") name = input("Name: ") while name != "": year = int(input("Year: ")) cost = int(input("Cost: ")) ad...
d89f2ec3d621dd087f51b4c7280e6c6227b2a242
1c8d9eccdd8336aca9d928e9eb19fed69ffc0845
shaikezr/FractalZoom
/Complex.py
Python
py
2,370
no_license
class Complex: """ represent and manipulate complex numbers """ def __init__(self,x=0,y=0): """create a complex number """ self.real = x self.imag = y def __str__(self): """ Pretty print complex number. """ s = "" if self.real != 0: s+=str(self.re...
932c967588c26b0e7ab0b8fa5f856c04881d6c92
6f57b008d1d34e73ae41b750fc9b882bd3e7ad85
qwanysh/url-shortener
/backend/src/shortenings/signals.py
Python
py
371
no_license
from django.db.models import signals from django.dispatch import receiver from shortenings import utils from shortenings.models import Shortening @receiver(signals.post_save, sender=Shortening) def set_expires_at(sender, instance, created, **kwargs): if created: instance.expires_at = utils.get_expiration...
ed2532abbe82bd96515dfc4b7f126fe8e74b3bf8
9bfbad34c3f86387081d62ed6f6d88dc1acbdc23
mehulsbhatt/fsa
/fsa/server/migrations/0009_add_sites_to_sipprofile.py
Python
py
13,148
no_license
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding M2M table for field sites on 'SipProfile' db.create_table('sip_profile_sites', ( ('id...
6af7a1e01e0186f16729264a5698e57470724447
603e4e2ff1e0758e96d3a1331e3726e05af68917
guotong1988/graph_network_zoo
/model_gnn_1step.py
Python
py
3,267
no_license
# only one node and its one step neighbor from model_base import ModelBase import time from util.common_function import * flags = tf.app.flags FLAGS = flags.FLAGS class GNN(ModelBase): def __init__(self, placeholders, batch_size=10, state_dim=4, node_num=8, edge_type_num=2, **kwargs): super(GNN, self).__in...
cebf34273ae7f91d3fcf130c755ba02ba34c7f87
bb61ba46ede9b44bd69f03137c675dc279891dce
St1904/GB_python_1
/lesson2/hard.py
Python
py
3,868
no_license
# Задание-1: уравнение прямой вида y = kx + b задано в виде строки. # Определить координату y точки с заданной координатой x. equation = 'y = -12x + 11111140.2121' x = 2.5 # вычислите и выведите y k = float(equation[equation.index('= ') + 2:equation.index('x')]) b = float(equation[equation.index('+ ') + 2:]) result =...
2b38da794a3b7195be0421c43e030489bf42845c
3079da4b36c848fcb986f56246444920c4512963
yigitatesh/gta_san_andreas_autonomous_driving
/utils/getkeys.py
Python
py
387
no_license
# getkeys.py # Citation: Box Of Hats (https://github.com/Box-Of-Hats ) import win32api as wapi import time keyList = ["\b"] for char in "ABCDEFGHIJKLMNOPQRSTUVWXYZ 123456789,.'APS$/\\": keyList.append(char) def get_pressed(): """gets pressed keys""" keys = [] for key in keyList: if wapi.GetAs...
77a07be686457785a3832536f14ff8fa3ee37788
31343a2da159aac5cf8a873b442429f65c860633
CDyWeb/swarmtracker
/catch/views.py
Python
py
3,893
no_license
import json import requests from django.conf import settings from django.contrib import messages from django.contrib.auth.hashers import make_password from django.forms import ModelForm from django.shortcuts import render, redirect from django.views import View from report.models import SwarmReport from swarm import R...
27ab3e91bc1a723e18473b894f6f42e7e294c6e8
69bfc04754f1f088f4fbc11aad54d3f25b902a93
Oliiveralien/Inpainting-review
/2020CVPR-Image Processing Using Multi-Code GAN Prior/MGAN Prior-Pytorch/super_resolution.py
Python
py
6,432
no_license
import os import argparse import torch import cv2 from utils.file_utils import image_files, load_as_tensor, Tensor2PIL, split_to_batches from utils.image_precossing import _sigmoid_to_tanh, _tanh_to_sigmoid, _add_batch_one from derivable_models.derivable_generator import get_derivable_generator from utils.manipulate i...
750b85b39ee16e06e7efb518d7dc7649a64084cd
6b45af293c41c6637b2fa133ea9afbd7dd41b2bf
git-zykk/MachineLearningPractice
/贝叶斯/朴素贝叶斯算法/使用朴素贝叶斯分类器从个人广告中获取区域倾向.py
Python
py
6,904
permissive
# -*- coding: utf-8 -*- # @Time : 2018/9/14 16:57 # @Author : 老湖 # @FileName: 使用朴素贝叶斯分类器从个人广告中获取区域倾向.py # @Software: PyCharm # @qq :326883847 import numpy as np def createVocabList(dataSet): vocabSet=set([]) for document in dataSet: vocabSet=vocabSet|set(document) vocabSet=sorted(vocabSet,key...
ba8609ef9bd6e5dcdd0c9305f6e0aeaf4cb116df
823e000f6540739ef08628d2eb1d0405fa7b4027
mohankumar1905/Deployment
/packages/ml_api/api/controller.py
Python
py
1,673
no_license
from flask import Blueprint, request, jsonify from fooddelivery.predict import make_prediction from fooddelivery import __version__ as _version from api.config import get_logger from api import __version__ as api_version from api.validation import validate_inputs _logger = get_logger(logger_name=__name__) prediction_...
e8e8b093fe480f556a44aaf4fc61c70821813e37
7f6a01b041e75ff958e89c119dec72ec03d2120b
gxgk/gdst_news
/app/school_news/services/xm_news.py
Python
py
1,759
no_license
import requests import logging from app import redis_store import pickle from urllib.parse import quote,unquote redis_plugin_prefix = 'wechat:plugins:news:xiaomiao' def update_cache(): urls = ['http://mp.weixin.qq.com/mp/homepage?__biz=MzI1MzA1MzQ0MA==&' \ 'hid=3&sn=2058fc67f54c5b913396dab4d...
803fabf937ab1438cc451252a6b0c8ee497d2cac
9921fbf1cf20a7aaf7fd43e962142545cfbaab81
karthikcs/machine-learning-coe
/svc/quiz.py
Python
py
649
no_license
# Import statements from sklearn.svm import SVC from sklearn.metrics import accuracy_score import pandas as pd import numpy as np # Read the data. data = np.asarray(pd.read_csv('data.csv', header=None)) # Assign the features to the variable X, and the labels to the variable y. X = data[:,0:2] y = data[:,2] # TODO: ...
d3cd2b1cb2210c4dafb019060b61d6bdf1e769d5
aa24a779e90ba7a857e3343b026fd85295861327
BroBezzubik/Seslan
/game/admin.py
Python
py
1,306
no_license
from django.contrib import admin from django.contrib.postgres import fields from django_json_widget.widgets import JSONEditorWidget from .models import Log, Game, Proffesion, Game_event_image, Game_event, Player, Map, Description, Information @admin.register(Proffesion) class PreoffesionAdmin(admin.ModelAdmin): pa...
122cdad62f442522520c78ab9208cb7e14c0f060
aa52512568e02df93d1a8a521154926f65e2b49e
Rellikiox/hs-card-generator
/packs_needed.py
Python
py
1,206
permissive
"""Hearthstone simulations All numbers taken from http://hearthstone.gamepedia.com/Card_pack_statistics""" from pprint import pprint import random from collections import defaultdict from collection import Collection from collection import Pack def simulate(runs=10000): common = 0 rare = 0 epic = 0 ...
d5e3ea40e329ba95fd80611d941cb28f02999d74
50d184fed78bd9847ff93bff6660ed707a91f810
laksh9950/School-Management
/api/views.py
Python
py
7,555
no_license
from django.contrib.auth import authenticate from django.contrib.auth.models import User, Group from django.core.exceptions import ObjectDoesNotExist # Create your views here. from django.db import IntegrityError from django.http import JsonResponse from rest_framework import generics, status, viewsets, permissions f...
b6c4e4e555b48749e538812479dcb9ad4234e189
d839d1b55831dabb67588efd8c570d7a542117f9
andrewgsavage/pandas
/pandas/core/dtypes/dtypes.py
Python
py
74,361
permissive
""" Define extension dtypes. """ from __future__ import annotations from datetime import ( date, datetime, time, timedelta, ) from decimal import Decimal import re from typing import ( TYPE_CHECKING, Any, cast, ) import warnings import numpy as np import pytz from pandas._libs import ( ...
6039f8065521c3202c50b253ce926d51dca4ac60
d62ab075167c094b64168698599499c78bd18c0a
jason0x43/home-assistant
/homeassistant/components/bosch_shc/sensor.py
Python
py
10,794
permissive
"""Platform for sensor integration.""" from boschshcpy import SHCSession from boschshcpy.device import SHCDevice from homeassistant.components.sensor import SensorDeviceClass, SensorEntity from homeassistant.const import ( CONCENTRATION_PARTS_PER_MILLION, ENERGY_KILO_WATT_HOUR, PERCENTAGE, POWER_WATT, ...
289654b4cd1213ce0bcf393dc66fd887dea8e671
099efecc148898ff8e790eb35f22e7b833469aae
fiorix/pbserver
/pbserver/web.py
Python
py
1,269
no_license
# coding: utf-8 # # Copyright 2010 Alexandre Fiori # based on the original Tornado by Facebook # # 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...
7f71092063b1e6906b80bc3458578a473841b6c5
4c3212788ee3a7942e1aa6b1a35b9727d43fc522
LSS-STgroup/LEGO_printer
/legoCoreC.py
Python
py
11,441
no_license
############################ Serial ########################## ######### final version 1 ############## import serial import time import threading import PID import numpy as np from time import sleep import cv2 as cv class LEGOPrinter: ser = [] A_encoder_num = 0 B_encoder_num = 0 C_encoder_num = 0 ...
95e7cad3d2ca7329ecb618345a16bf7fa6bd1d12
6b78c0bcbd229df9e2211378d2be789fe67eb273
Manu-Spurs/python_turtorial
/_82_add_window_tabs.py
Python
py
639
no_license
from tkinter import * from tkinter import ttk window = Tk() notebook = ttk.Notebook(window) #widget that manages a collection of windows/displays tab1 = Frame(notebook) #new frame for tab 1 tab2 = Frame(notebook) #new frame for tab 2 notebook.add(tab1,text="Tab 1") notebook.add(tab2,text="Tab 2") notebo...
66452f87cd5777043ca67678cf1b9112cb34c5d5
7a44ba9b39e9fedcaab63f554d7b5d07fa47a7a1
chocowind797/Python0709
/d02/Dict.py
Python
py
446
no_license
import random as r mode = int(input("輸入 0(比小)l, 1(比大): ")) user = r.randint(1, 6) + r.randint(1, 6) + r.randint(1, 6) pc = r.randint(1, 6) + r.randint(1, 6) + r.randint(1, 6) if mode == 1: winner = "玩家" if user > pc else "電腦" else: winner = "玩家" if user < pc else "電腦" result = "比{}, 玩家的點數{}, 電腦的點數{}, 勝者:{}"...
97c3dd6c14bfe11204e5b2ca8d73bba734d0f0c4
35dc58161565c69e0eed77d0fcb8161692c68877
aaronmccall/python_koans-completed
/python2/koans/about_list_assignments.py
Python
py
947
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Based on AboutArrayAssignments in the Ruby Koans # from runner.koan import * class AboutListAssignments(Koan): def test_non_parallel_assignment(self): names = ["John", "Smith"] self.assertEqual(["John", "Smith"], names) def test_parallel_ass...
a8468dcc4981d46d724db8da7be134c411ff6de0
c45cc787251b2955e60bbf05a4e7ba43ecaf6ca2
SREERAGI18/chromium
/third_party/wpt_tools/wpt/tools/manifest/download.py
Python
py
6,185
permissive
import argparse import bz2 import gzip import json import io import os from datetime import datetime, timedelta from urllib.request import urlopen try: import zstandard except ImportError: zstandard = None from .utils import git from . import log MYPY = False if MYPY: # MYPY is set to True when run unde...
c527662076a4423fd66554b484bb1a338f39706a
7673272ff2fd7572980a92149753cef876c169c8
dltech-xyz/Alg_Py_Xiangjie
/第6章/lintu.py
Python
py
544
permissive
import networkx as nx import matplotlib.pyplot as plt import numpy as np G = nx.Graph() Matrix = np.array( [ [0, 1, 1, 1, 1, 1, 0, 0], # a [0, 0, 1, 0, 1, 0, 0, 0], # b [0, 0, 0, 1, 0, 0, 0, 0], # c [0, 0, 0, 0, 1, 0, 0, 0], # d [0, 0, 0, 0, 0, 1, 0, 0], # e [0,...
99ebb5a983b2ae6863d21e972aec986402e6ac40
f7b68c985efa480bad57afab0c43661caafc259a
tunde02/Algorithms
/Python/5622.py
Python
py
287
no_license
d = {} num = 2 for i in range(0, 22, 3): d[chr(ord('A') + i)] = num d[chr(ord('A') + i + 1)] = num d[chr(ord('A') + i + 2)] = num num += 1 d['S'] = 7 d['V'] = 8 d['Y'] = 9 d['Z'] = 9 word = input() sum = 0 for spell in word: sum += d[spell] print(sum + len(word))
bd06e3b58b5002f268077bfb538d68b622f32382
8dd6d7628315d6d4cbb3d217c56b55d8b7ddab6c
tefra/xsdata-samples
/npo/models/schedule_event_search_type.py
Python
py
1,244
no_license
from __future__ import annotations from dataclasses import dataclass, field from xsdata.models.datatype import XmlDate, XmlDateTime from npo.models.channel_enum import ChannelEnum from npo.models.range_matcher_type import RangeMatcherType __NAMESPACE__ = "urn:vpro:api:2013" @dataclass class ScheduleEventSearchType(R...
77abf9a3a805bfae80d6d4277abb0be69c8b3c6a
6fb90de46aa99a3044119ec64847664a161db632
KongBOy/kong_model2
/Exps_7_v3/I_to_M_Gk3_no_pad/pyramid_5side/bce_s001_tv_s0p1_L4/step12_L2345678.py
Python
py
27,639
no_license
''' 目前只有 step12 一定需要切換資料夾到 該komg_model所在的資料夾 才能執行喔! ''' if(__name__ == "__main__"): ############################################################################################################################################################################################################# ### 把 kong_model2 加入 s...
009ae84409ce8b5675764b07a98c2e0c1035c4f6
56f9ba9329a880f9663b220e874a9557dffdca7c
prakharchoudhary/fun_with_python
/threads/threading/thread-lock-management.py
Python
py
1,344
no_license
import threading shared_resource_with_lock = 0 shared_resource_with_no_lock = 0 COUNT = 100000 shared_resource_lock = threading.Lock() ###LOCK MANAGEMENT### def increment_with_lock(): global shared_resource_with_lock for i in range(COUNT): shared_resource_lock.acquire() shared_resource_with_lock += 1 shared_r...
2f3aaf3b8e0dd2796cb45a67fec84189169e5fa3
4e880a65c6e76ccced8aad13ec9850636a6999f3
Lenny-Makori/NewsApp
/app/__init__.py
Python
py
354
permissive
from flask import Flask from .config import DevConfig from flask_bootstrap import Bootstrap # Initializing application app = Flask(__name__,instance_relative_config = True) # Setting up configuration app.config.from_object(DevConfig) app.config.from_pyfile("config.py") # Initializing Flask Extensions bootstrap = Boo...
732fdcd478e9f2b36c66919d244f8d50168e4af9
db9b5ea84c3a3cae6208746b16f8d854fb373d6e
VVladislaVLL/geometry-labs
/Lab3/utils.py
Python
py
3,897
no_license
from classes import Vector, Point from math import floor import random def determinant(p1, p2, p0): a = p2.x - p1.x b = p2.y - p1.y c = p0.x - p1.x d = p0.y - p1.y return a*d - b*c def scalar(p1, p2, p3, p4): line1 = Vector(p1, p2) line2 = Vector(p3, p4) return line1.x * line2.x + li...
41f68bb847ed308c5f4f2620845921894ba6904c
f52c46d0741cbea938d475b9cb19f62270aa7d89
WillHTam/reinforcement-pong
/q_play.py
Python
py
2,096
no_license
#!/usr/bin/env python3 import gym import time import argparse import numpy as np import torch from lib import wrappers from lib import q_model import collections DEFAULT_ENV_NAME = "PongNoFrameskip-v4" FPS = 25 # approximate speed of frames if __name__ == "__main__": parser = argparse.ArgumentParser() pars...
c0ba99a891c15ff279a5028abe3e0b726f6efdaf
ae0b899a7f7850f50578806e68d4c81c99eb0814
alexstanciu29/django_website_pipelines
/imageloader/sqlite3_helper.py
Python
py
355
no_license
import sqlite3 as lite def connect(): conn = lite.connect('db.sqlite3') cur = conn.cursor() return cur def get_images(): cur = connect() cur.execute("SELECT * FROM imageloader_image") return cur.fetchall() def get_pipelines(): cur = connect() cur.execute("SELECT * FROM imageloader_p...
b684752c755b298c0cfeda76cbc3509e52faf525
532acf76ac6d9acdf304b1b09bebb1cdf47fa216
susoooo/IFCT06092019IS
/programas_miguel/Python/exer4boletin2.py
Python
py
735
no_license
#4-Escriba un programa que pida el año actual y un año cualquiera y que escriba cuántos años han pasado #desde ese año o cuántos años faltan para llegar a ese año. print("Introduce o ano actual:") anoactual1=input() anoactual2=int(anoactual1) print("Introduce o ano desde/ata o que queres calcular:") anocal1=input() ...
475e7764eae2ba49ef1a14482c151ae77cfb6601
9ce5697eb1f67ab90cb377459cbddd7813040d04
zentropi/python-zentropi
/examples/05_hello_spaces.py
Python
py
739
permissive
from zentropi import Agent a = Agent('test-agent') @a.on_event('startup') async def startup(frame): await a.join('home') @a.on_interval('test', 0.9) async def test(frame): await a.event('hello') @a.on_event('hello') async def hello(frame): space_name = frame.meta.get("space").get("name") print(f'...
93906c7f702799dea49c653e956caec3597ac68e
547d120034f443f1f255c01f856933d81c754906
garyyli/Unit6
/warmup16.py
Python
py
211
no_license
#Gary Li #12/11/17 #warmup16.py dictionary = open('engmix.txt') for words in dictionary: if words.strip() != '': if words.strip()[0]== 'g' and words.strip()[-1]== 'l': print(words)
b1f16b0e6bca02bbfbd9c0edfc2577df9665359f
d10166804f670daccd4ecdbaf77a6c4a831b5e94
Abnormaltype/password_generator_project
/generator/views.py
Python
py
969
no_license
from django.shortcuts import render from django.http import HttpResponse import random # Create your views here. def home(request): return render(request, 'generator/home.html') def description(request): return render(request, 'generator/description.html') def password(request): characters = list('ab...
a9ec984f0a24608b819628705f712c8daf7c3fc2
d53a342fc53248d5ac4d33c3eb62bfa84fe390e7
longfei-zhang/st2
/st2client/st2client/utils/terminal.py
Python
py
2,999
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...
63e130f748a62b418b0fe09a8228bcb34a84ada9
a3999141f6fa2d477b18baaccf1c1ffb2602a929
musabahmed/baba
/v_7/GDS/shamil_v3/cooperative_stock_inventory/wizard/__init__.py
Python
py
477
no_license
# -*- coding: utf-8 -*- ############################################################################## # # NCTR, Nile Center for Technology Research # Copyright (C) 2011-2012 NCTR (<http://www.nctr.sd>). # ############################################################################## # This module is responsible...
61cbb6f77554514c01c2b7dd0858e74836bb8a5c
9a2841bf98ca0fd255072d894ca2fbab093d57f1
LavanyaRamkumar/Networking-app_Dynamic-Quiz
/venv/lib/python3.5/site-packages/celery/bin/graph.py
Python
py
6,759
permissive
# -*- coding: utf-8 -*- """The :program:`celery graph` command. .. program:: celery graph """ from __future__ import absolute_import, unicode_literals from operator import itemgetter from celery.five import items, python_2_unicode_compatible from celery.utils.graph import DependencyGraph, GraphFormatter from .base imp...
dcfbe4413baf42c89dafd249041c645975fa8c4e
939dc989f90cb4c20c1237db7df852e5e2a83e7c
feifly329/hot-samer
/lib/base_httphandler.py
Python
py
16,162
no_license
#coding=utf8 import tornado.web import tornado.httpserver import tornado.httpclient import os import re import json import urllib2 import datetime from urlparse import urljoin from tornado.options import options from tornado.httpclient import HTTPError from tornado import gen from tornado.log import app_log from ...
faf798d969b898c38cb4ad1456e8e671faf09260
eb22de06c3c79605d7a667d6d93c472404bde95c
ileasile/diploma
/python_graph_pattern_project/code/unique_tuples.py
Python
py
2,409
no_license
from DirectedWeightedGraph import DWGraph from typing import List, Iterable, Set, Tuple import numpy as np def unique_tuples(g: DWGraph, g0_index: List[int], g0: DWGraph, edges_matching, sets: List[Set[int]]) -> Iterable[Tuple[int]]: if len(sets) == 0: return () u = set() for s ...
2cce605baec3d2ddc2e97770d0e6ac7ec07d44b5
c6124a4f87a66346cd349b79fa808842625b7282
Beeter-yong/crawlCar
/clawler01/spiders/clawler_souhuWeb.py
Python
py
3,185
no_license
import scrapy import json from clawler01.items import SouhuItem class ClawlerSouhuwebSpider(scrapy.Spider): name = 'clawler_souhuWeb' allowed_domains = ['sohu.com'] start_urls = [ # 'http://sohu.com/' ] custom_settings = { 'ITEM_PIPELINES' : { 'clawler01.pipelines.Cl...
3a15d490836e9dc10c198fe32513d105b7dafaca
e47b40cb1f97b1848e5350e80f205baf761c841f
Shammy0786/Python-learning
/exstar.py
Python
py
292
no_license
#star printing print("pattern printing") num=int(input("enter rows : ")) print("enter 0 or 1 : ") bool_val=input("1 is ture and 0 is false : ") if bool_val=="1": for i in range(0,num+1): print("*"*i) if bool_val=="0": for i in range(num,0,-1): print("*"*i)
f105af83563a156316d08bfa64b3b8330df0ee4d
d02f3b5d3faa6dccabc92d769c51d7f0464b2b8d
jydiw/assorted-algorithms
/just-for-fun/novelkeys-webscraper.py
Python
py
2,324
permissive
import time from requests_html import HTMLSession ### input your variables here ### # the url you want to check # wrap it in quotes BASE_URL = 'https://novelkeys.xyz/collections/keyboards/products/nk65-entry-edition' # how often you want to check the site, in seconds INTERVAL = 10 # if you want it to print "sold ou...
f0f39beeab46cd08558c30f4f7d11281fa046a14
9c49a4f18df73bc0d974e187653ba20b52b5477e
AnhellO/DAS_Sistemas
/Ene-Jun-2022/angel-de-jesus-coronado-valdes/Practica_1/Ejercicio_2/sampleJSON.py
Python
py
2,193
permissive
import json class LeerArchivoJSON: def __init__(self,client): self.client = client def Leer_Archivo(self): print("id: " + self.client["id"]) print("first_name: " + self.client["first_name"]) print("last_name: " + self.client["last_name"]) print("company: " + self.client["compa...
ac5bc9c2135d4ca7b73c8b85a69d0528d351b5c2
7007cc4590a72bd0ecbe3b03fb876ec13e47d7ba
jspalink/python-gearman
/tests/admin_client_tests.py
Python
py
7,390
permissive
# -*- coding: utf-8 -*- import unittest from gearman.admin_client import GearmanAdminClient, ECHO_STRING from gearman.admin_client_handler import GearmanAdminClientCommandHandler from gearman.errors import InvalidAdminClientState, ProtocolError from gearman.protocol import GEARMAN_COMMAND_ECHO_RES, GEARMAN_COMMAND_EC...
ad4f1a9e04223b597245c636d613ed4ea1bddd5a
166094e0ad583d4f6ad08eb2cc6fcf1cd3e25f45
soniaarora/Algorithms-Practice
/Solved in Python/LeetCode/arrays/findMajority.py
Python
py
506
no_license
def find_majority(l): myMap = {} maxValue = 0 maximum = [] # (occurring element, occurrences) for n in l: if n in myMap: myMap[n] += 1 else: myMap[n] = 1 # Keep track of maximum on the go for n in myMap: if myMap[n] > maxValue: max...
71f33a7767bfa486267330e9301cdc97dcd354a6
52e543deef11ce5dc028ce2e7b5a85de01819b45
MegaYEye/rlgraph
/rlgraph/components/helpers/v_trace_function.py
Python
py
11,952
permissive
# Copyright 2018 The RLgraph 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 applicable...
ac1c2f08c21f9d0c51b0c31112e3d7967e9de99e
8f0a67ac914fa3006b9403e9b9c667ed5c1bd46c
keshavrajpandey/project
/product/migrations/0026_auto_20190615_2058.py
Python
py
813
no_license
# Generated by Django 2.1.7 on 2019-06-15 15:13 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('product', '0025_comment'), ] operations = [ migrations.RemoveField( ...
98bca5d996ff4e458f57731d24a9a6ac13551a4d
8dd7636ddd411c4514d4d2f4e653e316e1d4be79
vraoresearch/models
/official/vision/modeling/maskrcnn_model.py
Python
py
17,419
permissive
# Copyright 2022 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...
f2b93d874c69c096ad4fc80b4d2a6dfc4ca1e940
0164ceff715940f8821dd13fe40c3f34d30748dc
tabyldievanazgul/shop
/products/serializers.py
Python
py
865
no_license
from rest_framework import serializers from .models import Product, ImageProduct class ImageProductSerializer(serializers.ModelSerializer): class Meta: fields = ('id', 'image', 'product_id') model = ImageProduct class ProductSerializer(serializers.ModelSerializer): class Meta: # fields...
4a7404bde5f2b3c478a77a05123a126680108318
b58aa94fe3a960c9c142446823c30d0feac9cf8f
lucrae/brisland
/migrations/versions/3d3791d4082f_.py
Python
py
654
permissive
"""empty message Revision ID: 3d3791d4082f Revises: f12407981b84 Create Date: 2018-06-26 15:19:38.784190 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '3d3791d4082f' down_revision = 'f12407981b84' branch_labels = None depends_on = None def upgrade(): # ...
204c31901e6d9bbc2326660bab1de695d3b7bcae
c64c32a62770c8a5d8729318fdc5d21dc8c106d5
RodrigoAzuos/PI-2018-2
/apistrans/stransApi/manage.py
Python
py
541
no_license
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "stransApi.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Ar...
ebb946776376dca035b1c9e9aa8989234bea370f
0595845e565dcc36b267283b64915da98d502650
JustgoodDeal/Reddit-parser
/tests.py
Python
py
13,704
no_license
from reddit_parser import FileWriter from shutil import copy2 import json import os import requests import unittest class FileReplacer: reddit_test_file_name = "reddit-201901191955.txt" def replace_reddit_by_test_file(self): """Replaces reddit-file by test-file. Copies existing reddit-file to tempora...
8d9cf40e11614581de4fec39b5e431639112f619
f23bf83f6401ade98016dfaab93ece0a3630f3b8
Yokan-Study/study
/2017/12.12/python/jya-get-github-user.py
Python
py
238
permissive
import requests r = requests.get('https://api.github.com/users/jya9055') j = r.json() name = j['name'] blog = j['blog'] html_url = j['html_url'] if not blog: print name + '/ ' + html_url elif blog: print name + '/ ' + blog
215a3594dde01ca55dfc804d727bc31a8e6e1aae
2ffb06650cfc73da32edf9615331e88d4e4b16f5
koussay-daadouch/Kratos
/applications/TrilinosApplication/tests/test_trilinos_linear_solvers.py
Python
py
18,820
permissive
from __future__ import print_function, absolute_import, division import KratosMultiphysics from KratosMultiphysics.mpi import * #import KratosMultiphysics.mpi import KratosMultiphysics.TrilinosApplication import KratosMultiphysics.KratosUnittest as KratosUnittest from KratosMultiphysics.TrilinosApplication impor...
0ea17b0b8077ee86927da8ee03c8bfc4bb1e1710
45ed508bc2db717cb1afaa4ae1a1f933062d83fa
oblvg/flask-security
/tests/test_cli.py
Python
py
4,282
permissive
# -*- coding: utf-8 -*- """ test_cli ~~~~~~~~ Test command line interface. """ from click.testing import CliRunner from flask_security.cli import ( roles_add, roles_create, roles_remove, users_activate, users_create, users_deactivate, ) def test_cli_createuser(script_info): ...
55c93e711166309d1300ebc79edff940e1b5ff63
bcefa62b29abb566092e431c1f3e6726dd4f4dc6
pilliq/mongo-web-shell
/run_tests.py
Python
py
699
permissive
# Copyright 2013 10gen 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...
122d06a30120e13fbbe4640e76ad1200a46f51df
71f7569de5b10f27b49de7095f8ca5e64643f22b
shrutivarsha/authfile
/authfile/urls.py
Python
py
1,050
no_license
"""authfile URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Cl...
c1264baae1f1bb89272cf6e3663e5f368ca53083
eb55c035e8d27a3a4846811ab9bbd23ac89bb66c
chikkuthomas/python
/data collections/lists/to add even,odd and prime to list.py
Python
py
226
no_license
#add elements from a list to odd,even,and prime list listt=[1,2,3,4,5,6,7,8,9] even=[] odd=[] for i in listt: if(i%2==0): even.append(i) else: odd.append(i) print("even list",even) print("odd list",odd)
079e91046ee39b2467eae7e5d1ca5e79023705dc
4f914d1869d675aba4771630aff387d747994149
devangchhajed/ParkIT
/ML/dev/Main.py
Python
py
7,683
no_license
# Main.py import cv2 import numpy as np import os import DetectChars import DetectPlates #import PossiblePlate import requests # module level variables ########################################################################## SCALAR_BLACK = (0.0, 0.0, 0.0) SCALAR_WHITE = (255.0, 255.0, 255.0) SCALAR_YELLOW = (0.0,...
c57e766a2e6522f2803c35bb2784f384f708bf91
e670f5e75f0ffaf10116a7fb54dab2127e2ce870
wujekstaszek/advent_2020
/Day5/main.py
Python
py
630
no_license
with open("input.txt") as input_data: max_seat_id = 1 seats = [[0 for _ in range(8)] for _ in range(128)] for row in input_data: top = 127 bot = 0 left = 0 rigth = 7 for char in row: if char == 'F': x = (top - bot+1)//2 top -= x elif char == "B": x = (top - bot+1)//2 bot += x el...
d2295b5e8a045af0b7b2411d210ef78381c62655
0d1b37d3370de6b5619c6db5c4f85fb9a831fde5
rosoareslv/SED99
/python/Mailpile/2017/12/app.py
Python
py
9,376
no_license
import getopt import gettext import locale import os import sys import traceback import mailpile.util import mailpile.config.defaults from mailpile.commands import COMMANDS, Command, Action from mailpile.config.manager import ConfigManager from mailpile.conn_brokers import DisableUnbrokeredConnections from mailpile.i1...
2b6df62823422f8a0c0a57fb41f37e1fa8875475
968ab7416a39c41cb4f5856f36425bda5f9dc367
NKcell/leetcode
/867. Transpose Matrix/867.py
Python
py
387
no_license
class Solution: def transpose(self, A): B = list() for i in range(len(A[0])): tmplist = list() for j in range(len(A)): tmplist.append(A[j][i]) B.append(tmplist) return B def transpose1(self, A): return list(zip...
848f127a5e1c85d645daa524ffe7e87aee85b0f7
a054351a85294a0bfc7d0f804137b7341ac8f9ce
LinguaTechnica/notebooks
/scripts/server.py
Python
py
1,224
no_license
""" What's going on here? In summary, this is a server script. It creates a portal (socket) for clients to use to connect. This server listens to the port for anyone trying to connect to its address (ip). socket.accept returns (conn, addr) """ import socket import threading # The address and port for our server bi...