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 |
|---|---|---|---|---|---|---|---|---|
aade159723ebc7f9a39774d71198108289462691 | cd59caa21392ed75d63344954d9a7a7ac0403765 | BendyCabbage/PythonProjects | /SpeedyMaths.py | Python | py | 1,971 | no_license | import random
import time
import os
def questionAsker(operator,firstInt,secondInt):
try:
givenAnswer = int(input(f"{firstInt} {operator} {secondInt} = "))
return givenAnswer
except:
print("Not a valid answer, try again")
questionAsker(operator,firstInt,secondInt)
... |
9727fba53e667b6f7420d5b2d44805ce88d44f12 | 79f4e1e1eb7801372c13dae57d4cb06f051aca61 | fantasyxl99/fastapi | /tests/test_tutorial/test_schema_extra_example/test_tutorial004_an_py310.py | Python | py | 5,136 | permissive | import pytest
from fastapi.testclient import TestClient
from ...utils import needs_py310
@pytest.fixture(name="client")
def get_client():
from docs_src.schema_extra_example.tutorial004_an_py310 import app
client = TestClient(app)
return client
# Test required and embedded body parameters with no bodie... |
39dcb4667a586e162cc30db45ee50d6e3ffdb7cb | f4b92f598d572e25cab8fa886d6153b4b76caf3a | ericebersohl/tak_mcts | /src/types.py | Python | py | 2,281 | permissive | """Immutable types for board state and actions in Tak.
This module defines a NamedTuple representation of the board state and a NamedTuple representation
for each kind of action a player may take: either move or place. Finally, the module defines the
union type Action for ease of use in other modules.
"""
from copy i... |
dd8ded33ac4ebf61fc1a228e3ba9e17c794f9e18 | 092fec21983ee5a4684dc2f2e9ea1db8e8e2a3d3 | robzhuqiankun/yunbi_trade | /hftrend.py | Python | py | 774 | no_license | from yunbi.strategy.hf_trend import Strategy, Order
from yunbi.trade.client import get_api_path
from config import ACCOUNT_INFO
import os
def test_sccny_minute():
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "hf_sc.json")
demo = Strategy(symbols='sccny', account=ACCOUNT_INFO, config_path=p... |
774cf3dde88d16cc18fb3955db1a91bd7ff63813 | 0aa02f5efdbe1b4bd48de0770a1322a384d1fc67 | Neoqck/fangyoukuxt | /服务端server/interface/common_interface.py | Python | py | 5,020 | no_license | from db import models
import datetime
from lib import common
from threading import Lock
from db.session_data import session_dict
# 公共锁
mutex = Lock()
# 注册
def register_interface(recv_dict, conn):
username = recv_dict.get('username')
# 1.判断用户是否存在 ---接收到--->[{},{}] 列表套字典
user_obj_list = models.User.orm_s... |
fe7b6892b2212c6f425ffc5fe652398eac1179fa | 0e6c754d6b1a398d20932a03893ad5515e26bb94 | UCLA-SEAL/QDiff | /data/p2DJ/New/R2/benchmark/startPyquil187.py | Python | py | 1,171 | permissive | # qubit number=2
# total number=12
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(0) # number=1
p... |
251438dfe76b93528f2acb5200bf12848e9236e6 | 6ddf23c509de955c7ea9be84fec482fc358ba4e9 | indurkhya/DevOps_Blogger | /Blogger/project/contacts/models.py | Python | py | 546 | no_license | # contacts models
from project import db
class Contacts(db.Model):
# sno , name , email , phone_no , msg , date #db variables
sno = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), nullable=False)
email = db.Column(db.String(20), nullable=False)
phone_no = db.Column(db.String... |
dd54a8e186729523383aac6960501cebf961c2c7 | bfac406e41906e6992629f3852b824d4bfa2b965 | FalaleevDanila/nomad-deployer | /core/test_services.py | Python | py | 8,273 | no_license | import json
from aiohttp.web_exceptions import HTTPBadRequest
from nomad.api.exceptions import BadRequestNomadException
from core.exceptions import HTTPApiNomadClaimsValidationError, HTTPApiNomadClaimsCheckError, \
HTTPApiBoundClaimsCheckError
from core.services import NomadClaimsService, NomadService, ConfigServ... |
a8dbe800146658eafccf35ddbd49b655ae657d9c | 766d6877d05a71145932dd1cbab8a1c1e267648c | cstrider13/DecryptFun404 | /hw2_starter.py | Python | py | 2,014 | no_license | #!/usr/bin/env python
### hw2_starter.py
import sys
import BitVector
from generate_round_keys import *
from get_encryption_key import *
expansion_permutation = [31, 0, 1, 2, 3, 4, 3, 4, 5, 6, 7, 8, 7, 8, 9, 10, 11, 12, 11, 12, 13, 14, 15, 16, 15, 16, 17, 18, 19, 20, 19, 20, 21, 22, 23, 24, 23, 24, 25, 26, 27, 28, 2... |
3a9a8ac12adf80f4d4330f6e8439a5c609d2cd8d | fdb9ba2e4ae95fa6e967be78e2ed5e82db1a3955 | Hardworking-tester/autotest | /log/result_log.py | Python | py | 415 | no_license | # encoding:utf-8
import logging
def ResultLog():
log_path="F:\\resultlog\\resultlog.txt"
log=logging.getLogger("wwg")
log.setLevel(logging.INFO)
filehandler=logging.FileHandler(log_path)
filehandler.setLevel(logging.INFO)
formatter=logging.Formatter("%(asctime)s: %(message)s","%Y年%M月%d日 %H:%M:%S... |
0069130fb97598dc390272c807e989d8cb253724 | 4804acdd4f86f849dc084966f5cf844fe3136e90 | AshwiniR97/OpenCV | /mouseEvents.py | Python | py | 1,791 | no_license | import cv2
import numpy as np
"""
# Prints all the classes and member functions inside cv2 package that contain 'EVENT' keyword in them
events = [i for i in dir(cv2) if 'EVENT' in i]
#['EVENT_FLAG_ALTKEY', 'EVENT_FLAG_CTRLKEY', 'EVENT_FLAG_LBUTTON', 'EVENT_FLAG_MBUTTON', 'EVENT_FLAG_RBUTTON',
'EVENT_FLAG_SHIFTKEY', ... |
e5b855c9e9d9dbd9d1862daca86a389301599408 | 361e83153d57689705ca0cce822ad9c05c03bda7 | theRealSuperMario/lmdis-rep | /nets/encoder/general_64x64.py | Python | py | 3,302 | permissive | import numpy as np
import tensorflow as tf
import prettytensor as pt
from net_modules.common import *
from net_modules import keypoints_2d
import math
from net_modules.hourglass import hourglass
import zutils.tf_math_funcs as tmf
from net_modules.auto_struct.keypoint_encoder import Factory as BaseFactory
class Facto... |
cf01d13b37dbd6f4923f129c766d122613ed1bc0 | 341df31f50958657754a9b79d427b995abc2c187 | Alexander-Burashnikov/Python_for_testers | /search_bruh_test.py | Python | py | 1,980 | permissive | # -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException... |
3f3cf25895f73b2fc32a5209e6d1ce55c63deabb | 45cbb5b5d93aadcd1fdc887869aa44df6349e26b | Burmakova/homework_01 | /task_2_5.py | Python | py | 734 | no_license | # Дана непустая последовательность ненулевых целых чисел, за которой следует 0.
# Определить, сколько раз в этой последовательности меняется знак.
from random import *
num = [0]
total = 0
print('Введите длину последовательности:', end=' ')
for _ in range(int(input())):
random_num = randrange(-99, 100)
... |
07c7cbac4d5210a80d3709d37c9140f29daf8621 | 49a773e4fd82fed8ba89960f9d258abea4daf026 | SamuelLarkin/AdventOfCode2019 | /02 - 1202 Program Alarm/tests/test_solutions.py | Python | py | 402 | no_license | #!/usr/bin/env python3
import unittest
from solutions import parse
from solutions import process
class TestSolutions(unittest.TestCase):
def testParse(self):
self.assertEqual(parse('1,9,10,3,2,3,11,0,99,30,40,50'), [1,9,10,3,2,3,11,0,99,30,40,50])
def testProcess(self):
data = parse('1,9,1... |
23294ed733539aa539f0fc89d1f1bb0c00685cf2 | c2853975292321abf45957a3b455eaf72d36250f | xiaopacong/pythontest | /demo3.py | Python | py | 281 | no_license | class Person():
#成员变量
name="张三"
age=22
address="长沙"
def eat(self):
print(self.name,"吃饭")
def run(self):
print("干活赚钱")
def love(self,):
self.run()
p=Person()
# print(p.name)
p.love() |
fc3a865dd3874399d48c79ec9d8f0cad61a30860 | b912e71064bf3c3692508ad858e57c235197377f | 718795325/python-code | /django/16/代码/axf/user/views.py | Python | py | 2,992 | no_license | from rest_framework import status
from rest_framework.generics import GenericAPIView,CreateAPIView
from rest_framework.response import Response
# Create your views here.
from home.models import AxfUser
from user.userserializers import UserSerializer, UserRegisterSerializer, LoginSerializer
from user.util import token... |
8850e1a44e880190f26470e1d0f3549ed6461e8c | 194e15c9f979517659e146518686bda6bb5afd61 | F7Alexa/BluPhy-Area-Azul-Blumenau | /Software/back-end/api/models.py | Python | py | 2,899 | no_license | """
Módulo responsável pelos modelos (Tabelas) do banco de dados.
"""
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, Float, DateTime
from sqlalchemy.orm import relationship
from .database import Base
class Person:
name = Column(String)
email = Column(String, unique=True, index=True)
... |
7e3026458f2e7abf6d394899b675eacdebd33245 | 2a17a6e6005b09707e6100cade25f778ac3d2638 | magfest/magbot-jenkins | /jenkins.py | Python | py | 3,403 | no_license | from errbot import BotPlugin, botcmd
from jenkins import Jenkins as JenkinsAPI
from jenkins import JenkinsError
import pprint
class Jenkins(BotPlugin):
def activate(self):
if not self.config:
# Don't allow activation until we are configured
message = 'Jenkins plugin is not configur... |
157142a324dd0e21cc9a6740b5125ef4fb13d239 | 3f5b784ae6f4b1e39b740d704cbaaba47d7ce09a | cbherbert/odysseus | /odysseus/ns2d.py | Python | py | 16,466 | no_license | """
Module for direct numerical simulations of the 2D Navier-Stokes equations using Dedalus.
For instance, from ipython:
> from odysseus import ns2d
> ns2d.NavierStokesDecaying2D(128, 128, nu=5e-3, alpha=1e-2).run_simul(fout=None, dt=5e-3, initial='random', kf=10)
> ns2d.NavierStokesForced2D(128, 128, kf=10, alpha=1e-... |
174a727f264cff7749c5315247b01a542d9587a8 | 00f5d3aeacffb291a8da993806d25d951e1a426b | antondelchev/Text-Processing---Exercise | /02. Character Multiplier.py | Python | py | 750 | no_license | text = input().split()
total_sum = 0
if len(text[0]) == len(text[1]):
for position in range(len(text[0])):
result = ord(text[0][position]) * ord(text[1][position])
total_sum += result
elif len(text[0]) > len(text[1]):
for position in range(len(text[1])):
result = ord(text[0][po... |
306b11ff7aa942eda420abfcddf29ed89be786ca | ec3fe04b203a24c172e04a2e81e92f72986dd216 | gonanc13/Cylinder2DFlowControlDRL | /Rectangle2DFlowControlWithRL/baseline_flow/env.py | Python | py | 11,246 | permissive | """Resume and use the environment in the configuration version number 2.
Here you set the environment parameters.
You can modify, for example, the position of the probes, reward function used, etc.
Define:
-geometry parameters
-mesh parameters
-profile: Inflow profile
-mu, rho: flow parameters - ... |
3722d9ccea07af2b879fd92770181ca648fc8db6 | 4c5a5aa6c8977baa2360db7d522f35ab5e5201a3 | Jeniffer89/MANB1153-Data-Mining | /data_mining_exercise1.py | Python | py | 716 | no_license |
# coding: utf-8
# In[3]:
import pandas as pd
import numpy as np
import csv
# In[4]:
food = csv.reader('/Users/user/Documents/datamining/en.openfoodfacts.org.products.ts)
# In[5]:
food.head(5)
# In[6]:
food = csv.reader('/Users/user/Documents/datamining/en.openfoodfacts.org.products.tsv',sep='\t')
# In... |
717ef0cde06e41751de74de4e3609ddb9c532da0 | ec9d6f35f917ad79ed5d8ead754aedd815f342ae | junxiongcn/imagepy | /imagepy/menus/Plugins/Macros/recorder_wgt.py | Python | py | 4,950 | permissive | import wx, weakref
from imagepy.core.engine import Macros
import os.path as osp
class Plugin ( wx.Panel ):
title = 'Macros Recorder'
def __init__( self, parent ):
wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL )
bSizer1 = wx.BoxSiz... |
ac457a2dbf95879961c4ef9f4742602c0615663c | 4a7cf71cafac7a6dcfc553e54b9318ffc1892bb5 | Ryuuken-dev/Python-Zadania | /Moduł III-lekcja 15/15.1.py | Python | py | 502 | no_license | """
Zapytaj użytkownika o 10 liczb dodatnich. Jeśli użytkownik poda liczbę ujemną to nie powinna być ona zliczana.
Wyświetl największą i najmniejszą liczbę.
"""
numbers = []
done = False
while not done:
users_number = int(input('Podaj liczbę: '))
if len(numbers) == 9:
done = True
if users_number < 0... |
849d8006e4c09a7b066eac680d5b6e897ede225b | 192108eca965f80c7daa47400180715880369f0e | petrjasek/eve | /eve/__init__.py | Python | py | 2,049 | permissive | # -*- coding: utf-8 -*-
"""
Eve
~~~
An out-of-the-box REST Web API that's as dangerous as you want it to be.
:copyright: (c) 2017 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
.. versionchanged:: 0.5
'SERVER_NAME' removed.
'QUERY_WHERE' added.
'QUERY_SO... |
6cb4045450ea942b9ec473df466d188fb23d8a92 | 76194c130ce45ac36c99ec749f49a5bd52b2d1b5 | geo5555/tkinter_example | /thread_pool_executor_pool.py | Python | py | 988 | no_license | import concurrent.futures
from ipaddress import ip_network, ip_address
import platform
import subprocess
ip_list = [str(ip) for ip in ip_network("192.168.2.0/28").hosts()]
def checkPlatform(Name):
return Name.lower() == platform.system().lower()
def ping_ip(ip):
if checkPlatform("Windows"):
ping_re... |
f87c1de1d03dc0916f0b3e291fd4c254f34c5386 | 579772dd35edd69494a8a1b1ca48774ba91fbb51 | derwinterence04/recipe-app-api | /app/core/migrations/0002_tag.py | Python | py | 682 | permissive | # Generated by Django 3.0.8 on 2020-07-28 01:00
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.CreateModel(
... |
b184e448f797a71af9172e260b9eef2e2069ca72 | 34dbc53e79ea431bba8ae3ff133d9acca2570a0c | pombredanne/warpdrive | /docs/conf.py | Python | py | 9,424 | permissive | # -*- coding: utf-8 -*-
#
# warpdrive documentation build configuration file, created by
# sphinx-quickstart on Mon Feb 15 16:13:54 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... |
e7ef688891a149d4fb36378483e7af4de2783eca | 8f91aba7c89b9cba86a426110157a45afd34c70f | cnxtech/wooqi | /wooqi/src/plugin_spec.py | Python | py | 4,119 | permissive | # -*- coding: utf-8 -*-
"""Module contains method that will be replaced by the plugin.
:author: Pawel Chomicki
"""
import os
import re
def pytest_runtest_logstart(self, nodeid, location):
"""Signal the start of running a single test item.
Hook has to be disabled because additional information may break out... |
2bb1f6c2a0a9e4191586648b4730ab6a0e9df9e1 | 9d16024fb369ef2bc93a7591ed7cc5c6723c476b | franckmartin3d/ppab | /ch9_AlienBlaster.py | Python | py | 481 | no_license | #Franck 04/05/2018
#Alien Blaster
#Demonstrate object interaction
class Player(object):
"""A Player in a shooting game."""
def blast(self, enemy):
print("The player blast an enemy.\n")
enemy.die()
class Alien(object):
"""An alien in a shooter game."""
def die(self):
print("The ... |
32c285bf24719e94a703324c934d3b6371691d4c | 2f5a901277470a89b8254b394dc103843e4111f4 | judy2k/applied_stats | /applied_stats/mle.py | Python | py | 6,469 | permissive | import numpy as np
"""
"The method of maximum likelihood in a sense picks out of all the possible
values of theta the one most likely to have produced the given observations
x1, x2, ..., xn. " (Sahoo, 2008)
"The rationale behind point estimation is quite simple. When sampling is from
a population described by a pdf ... |
4e8d8f65f59d0e57a24e579b9727ddbeb409bd20 | 2fd884ebd909cad5efc231775be8feac6071cd2e | gh0std4ncer/cve-search | /db_blacklist.py | Python | py | 2,413 | permissive | #!/usr/bin/env python3.3
# -*- coding: utf-8 -*-
#
# Blacklist feature to mark CVE's for CPE's of personal interest
#
# Software is free software released under the "Modified BSD license"
#
# Copyright (c) 2014-2015 Pieter-Jan Moreels - pieterjan.moreels@gmail.com
# Imports
# make sure these modules are available on ... |
2f168c6a10b2cb41135c104edbfe5fc366374a89 | d29b8c379aeece917e2ee64aa10cb1442f553347 | ErikDz/Easy-Send---Versi-n-1.0-CON-IMG | /Versión 1.0 con imag/funciones.py | Python | py | 5,018 | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu May 28 19:37:43 2020
@author: erikd
"""
from PyQt5 import QtCore, QtGui, QtWidgets
import time
import re
from selenium.webdriver.common.keys import Keys
import xerox
class EasySend:
def __init__(self, driver):
global counter
cou... |
c0b4f3d73efde404d19dda62181e5a7409a1dde4 | defc128f5147894bf3ac467a57f17ebcf5922765 | nisha2109/APS-2020 | /evenfibonaccisum.py | Python | py | 223 | no_license | def evenfibsum(n):
if(n<2):
return 0
f1=0
f2=2
sum=f1+f2
while(f2<n):
f3=(4*f2)+f1
if(f3>n):
break
f1=f2
f2=f3
sum+=f2
return sum
t=int(input())
for _ in range(t):
n=int(input())
print(evenfibsum(n))
|
ef89286e39b08f2bb62e8ed8fed87ebc4138fce5 | f9f1d451931355e513b497a1eb258fd20fcd4ed9 | yanggicane/textanalysis | /textanalysis.py | Python | py | 6,195 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 23 10:52:03 2019
@author: YTang
"""
import re
re.match('abc', 'abcdef')
re.match('abc', 'fedabc')
re.search('abc', 'fedabc')
word_regex='\w+'
re.match(word_regex, 'hi there!')
my_string="Let's write RegEx!"
re.findall(r"\w+", my_string)
sampl... |
710bd5b66b2796d4256e8ff2f2dab0b0330d485e | 1005757ec0318c27a94e206818b7981d3aa03645 | LARS-research/SNAG | /rlctr/trainer.py | Python | py | 21,552 | no_license |
import time
import numpy as np
import scipy.signal
import torch
import warnings
warnings.filterwarnings('ignore')
import rlctr.utils.tensor_utils as utils
from pyg_file.model_manager import GeoCitationManager,GeoCitationManager_PPI
import hyperopt
from hyperopt import fmin, tpe, hp, Trials, partial, STATUS_OK, rand
... |
a3c24b535c7f66fd3542429040f5dce278b131fd | db0ac4f833afc252bafbf1ea6e16af882a6c20ee | xwbxxx/PCIC2021_causal_discovery_dmirlab | /code/castle_mod/algorithms/gradient/gran_dag/base/__init__.py | Python | py | 295 | no_license | from .base_model import NonlinearGauss
from .base_model import NonlinearGaussANM
from .dag_optimizer import TrExpScipy
from .dag_optimizer import compute_A_phi
from .dag_optimizer import compute_constraint
from .dag_optimizer import compute_jacobian_avg
from .dag_optimizer import is_acyclic
|
81197aa96d66d7e191c2af2817f74dd05e2bfb5f | 890aa18d0f123b7a436bde261b0dc31011282006 | wowr00d/Prac07 | /Prac07/guitarTest.py | Python | py | 456 | no_license | class Guitar:
def __init__(self, name="", year=0, cost=0):
self.name = name
self.year = year
self.cost = cost
# def get_age(self):
# age = 2016 - self.year
# return age
def is_vintage(self):
if 2016 - self.year > 50:
return True
return Fa... |
eebd4115c7af1f10caa6591ba8564a3fc4d94a95 | 632eb080ace229f533e2a8926cc494a036ac3981 | huangbop/webhooks_handler | /webhooks_handler/urls.py | Python | py | 787 | permissive | """webhooks_handler URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
... |
45aaa5d210bf263e7a9f7c7fc5ab32ce0dbf5ad7 | 7ac8cbba550ca64ca247b165fe8e56544cc59b17 | nashid/iclr2019-learning-to-represent-edits | /diff_representation/asdl/demo.py | Python | py | 2,303 | permissive | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from diff_representation.asdl.grammar import ASDLGrammar
from diff_representation.asdl.syntax_tree import AbstractSyntaxTree
from diff_representation.asdl.transition_system.hypothesis import Hypothesis
from diff_representation.asdl.transition_sys... |
7d754a9d3e87a97fb295b05187cc501c6e7a498d | 7e2b528c1d402f6001c0b4b562aef6f75ae22116 | sczesla/PyAstronomy | /src/pyasl/phoenixUtils/read.py | Python | py | 4,070 | permissive | from __future__ import print_function, division
from PyAstronomy.pyaC import pyaErrors as PE
import gzip
import re
import os
import numpy as np
import six.moves as smo
def readUnit7(fn, minwl=None, maxwl=None):
"""
Read PHOENIX Unit 7 files.
The documentation of the PHOENIX output
files may be found ... |
2be836074ac3b22a4a097e4dbcff2f2bd13a57ee | 4f59b6afa0d8c2fada306518e48ead7ea80105a3 | HelloAiPython/learnpycharm | /PygameHelloWorld2.py | Python | py | 728 | no_license | import pygame, sys
pygame.init()
size = width, height = 600, 400
screen = pygame.display.set_mode(size)
BLACK = 0, 0, 0
pygame.display.set_caption('PygameHelloWorld2')
ball = pygame.image.load("images/PYG02-ball.gif")
speed = [1,1]
ballrect = ball.get_rect()
fps = 300
fclock = pygame.time.Clock()
while True:
for... |
765420703f3e3525e59e1015bec516d58f552c85 | e2df04befe3b0210c1b4a55ad336ffb8c0d2074d | HiPiH/life | /src/utils/lib/shortcuts.py | Python | py | 3,359 | no_license | from django.shortcuts import get_object_or_404, render_to_response, _get_queryset
from django.http import Http404
from lib.exceptions import Ajax404
from django.template import RequestContext
from lib.http import JsonResponse
def get_object_or_404_ajax(*args, **kwargs):
try:
return get_object_or_404(*args... |
966ac0b3b3e52dddcf62085c12c90d8e6a7997f1 | 96df32fcfd07a78b893e78f6963540d6f092f2ba | mai05410/my-first-blog | /mysite/settings.py | Python | py | 3,140 | no_license | """
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 2.0.13.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
#... |
ff1744c91bcc5715c5868a98007efe7582466afd | 9010dcd6be4f7226a82558a17b8009a5771494a9 | BeTheCode/sharing | /tic-tac-toe.py | Python | py | 2,040 | no_license | import os
usr = {'X':'','O':''}
lnsd = {'1':'1','2':'2','3':'3','4':'4','5':'5','6':'6','7':'7','8':'8','9':'9'}
def print_board():
os.system('clear')
print(lnsd['1']+'|'+lnsd['2']+'|'+lnsd['3'])
print('-----')
print(lnsd['4']+'|'+lnsd['5']+'|'+lnsd['6'])
print('-----')
print(lnsd['7']+'|'+lns... |
1c5397d9f62fa3934b433a984479508e77de75a3 | a3ee441ad0fd46a95bc3de7a6e8c73839cad85e5 | vam-sin/panther | /src/dl_models/cln_protbert.py | Python | py | 8,492 | no_license | # libraries
import pandas as pd
import numpy as np
from sklearn import preprocessing
import biovec
import math
import pickle
import tensorflow as tf
from keras.models import Model, load_model
from keras import optimizers, regularizers
from keras.layers import Dense, Dropout, BatchNormalization, Conv1D, Flatten, Input... |
0e800ecd0aef2848e1ea301063afadc3244b660c | 4a9053da5093a69a76e69beaaac335a1de4df881 | BinaryBrain/Folamour-VR | /terrain-generation/terrain-generation.py | Python | py | 1,039 | no_license | import sys
from noise import pnoise2, snoise2
# var map = [
# [
# [1,1,1,1,1],
# [1,1,1,1,1],
# [1,1,1,1,1],
# [1,1,1,1,1],
# [1,1,1, , ],
# ],
# [
# [1,1,1,1,1],
# [1,1,1,1,1],
# [1,1, , , ],
# [ , , , , ],
# [ , , , , ]
# ]
# ];
oct... |
b337000249e32dfcf9e83d496b2fece6323c8980 | 4404562e4ae15061724e7470e74e3319fd367f7c | AZIZ-dev1/TP-serveurclient | /client.py | Python | py | 1,053 | no_license | import socket
hote = "localhost"
port = 12800
connexion_avec_serveur = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connexion_avec_serveur.connect((hote, port))
print("Connexion établie avec le serveur sur le port {}".format(port))
num1 = input("Enter first number: ")
num2 = input("Enter second number: ")
op ... |
2ff4f7307e9f8d22f50e8c5048f2d575ac2f5d8b | 87c876401671a55993676de236a222228730e576 | Jetina/openconcept | /examples/aircraft_data/TBM850_mission.py | Python | py | 743 | permissive | data = dict()
mission = dict()
takeoff = dict()
takeoff['h'] = {'value': 0, 'units': 'ft'}
mission['takeoff'] = takeoff
landing = dict()
landing['h'] = takeoff['h']
mission['landing'] = landing
climb = dict()
climb['vs'] = {'value': 1500, 'units': 'ft/min'}
climb['Ueas'] = {'value': 124, 'units': 'kn'}
mission['climb... |
4f7d94decaf5daa74ff342a66a4ba861d543a46a | b5fbb5b95314b38939fdb0ee0ef28b4e18c640c8 | angelinetanvy/AdverFacial | /SMIC/MicroExpSTCNN.py | Python | py | 11,034 | no_license | import os
import cv2
import numpy
import imageio
from sklearn.metrics import confusion_matrix
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution3D, MaxPooling3D
from keras.optimizers import SGD, RMSprop
from keras.call... |
459f8f530214fba4b34e5c5da137c0ecb7a5452a | aff6cf7f3a64ee60aa958db2fe7446864f76167e | zyp521/python | /爬虫/scrapy_project/animal_world/animal_world/my_settings.py | Python | py | 4,568 | no_license | # -*- coding:utf-8 -*-
# @Time : 2020/11/17 0017 15:04
# 文件名称 my_settings.py
# 开发人员 周云鹏
# 开发环境 PyCharm
import random
custom_settings = {
# 请求头
'DEFAULT_REQUEST_HEADERS': {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en',
'user-agent'... |
0df7623d095275d26f4e9d825750facf6e19adb2 | 2aec699fd9710fb835bb1b36eb5f2ae8c1a2ace4 | FlUxIuS/powpy | /pwplib/profiles/Security.py | Python | py | 6,536 | permissive | import wmi, os, platform
from pwplib.Machine import *
from pwplib.OperatingSystem import *
class Security(Machine):
"""
Security Profile example --> to be extended ;)
"""
__c2 = None # security machine wmi handle
__c3 = None # security machine wmi handle2
def __init__(self, ... |
ee3a45d6579a79cb0cc80c8bf80c6acf0a3f045b | 62d5c4ebb5edfdd8b540086e07bf931df71fcdb2 | kesarb/leetcode-summary-python | /practice/solution/0056_merge_intervals.py | Python | py | 466 | no_license | class Solution(object):
def merge(self, intervals):
"""
:type intervals: List[List[int]]
:rtype: List[List[int]]
"""
value_list = sorted(intervals)
res = [value_list[0]]
for interval in value_list[1:]:
if res[-1][1] >= interval[0]... |
e10d5f2daa14f4abc2207833a93f8eb9848cc0ff | 2a6937ce0f624473f1f88218b85c8944b175307a | rivit98/concurrency-theory | /lab10/lab10.py | Python | py | 4,025 | no_license | import numpy as np
import matplotlib.pyplot as plt
import network_line_graph as nlg
from collections import defaultdict
from PIL import Image
import networkx as nx
class Graph:
def __init__(self, word, independent_operations):
self.edges = defaultdict(list)
self.word = word
self.N = len(wo... |
d05945c6fa591d2a98009b97602ae8079fd04253 | 9f42743416f9a0f40ef85ec4881c810199976b37 | amyphenjati/mis3640 | /OOP/OOP3/Time1.py | Python | py | 1,630 | no_license | class Time:
"""
Represents the time of day.
attributes: hour, minute, second
"""
def __init__(self, hour=0, minute=0, second=0):
"""Initialize the object"""
self.hour = hour
self.minute = minute
self.second = second
def __str__(self):
"""Returns a string... |
a824a07aef42feb97021ed2651882ec97118821f | ad8890cf77de5772504eb58b6e6be57195ea7fd3 | abhay2k22/synthetic-data-ex | /example-1/SeriesGeneration.py | Python | py | 1,772 | permissive | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def loadData(fileName):
data = pd.read_csv(fileName, delimiter=',')
return data
def generateNoOfCases(df):
# drop the row or column with any null value
data = df.dropna(how='any')
# find unique cases list
case... |
62564437b3614011be35d35290fce989a0502cc4 | e9a1ef2737d931ac8f39066f4442f1796007830f | rtnF14/OpenGL-Exercise | /hp_polytron/hp2.py | Python | py | 4,942 | no_license | import pyglet
import OpenGL
from pyglet.gl import *
from pyglet.window import key
from OpenGL.GLUT import *
import sys, time, math, os, random
import Image
WINDOW = 400
INCREMENT = 5
def loadTexture(filename):
img = Image.open(filename).transpose(Image.FLIP_TOP_BOTTOM)
textureIDs = (pyglet.... |
dfe4f878d5d25bb05231cc1893926a8fdf6f3197 | f23833b85e062e2dd1c2b4060474b55f09d309a7 | Siimon13/PAS-Health | /pas/models.py | Python | py | 773 | no_license | from __future__ import unicode_literals
from django.db import models
# Create your models here.
class User(models.Model):
first_name = models.CharField(max_length = 200, null = False)
last_name = models.CharField(max_length = 200, null = False)
ethnicity = models.CharField(max_length = 200, null = False)
... |
5c3addfa042247f1fc3b4c3fecd42053b2e8b798 | 24b4a53711b8fe18a02f1cc45cfdec9e2596d1e4 | juldepol/todo-flask | /server/server.py | Python | py | 2,021 | no_license | from flask import Flask, request, Response
from flask_api import status
import sqlite3
from sqlite3 import Error
import json
from flask_cors import CORS
from task import Task
app = Flask(__name__)
cors = CORS(app, resources={r"/*": {"origins": "*"}})
db_file = "database.db"
def connect_db(db_file):
try:
... |
cddde33c361a39b4ea5d167b0e9c4f31b2c6a31b | fa7aa9906b0e09641bffc447f980b1247b310f70 | rchamorro/pulumi-azure-nextgen | /sdk/python/pulumi_azure_nextgen/recoveryservices/v20201201/get_private_endpoint_connection.py | Python | py | 5,197 | permissive | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
4ecca285644748cc75e82e9501a86f97266fcff5 | 45a104bf40432e2e18cacab9ed2a0dbe45212cf9 | silenttemplar/python_ML_lecturce | /source/ch6/p3/ch6_3_1.py | Python | py | 886 | no_license | import numpy as np
np.random.seed(seed=1)
# 데이터 수, 분포 수
N = 100
K = 3
X = np.zeros((N, 2))
# 2클래스 분류용
T2 = np.zeros((N, 2), dtype=np.uint8)
# 3클래스 분류용
T3 = np.zeros((N, 3), dtype=np.uint8)
# 분포의 중심, 분포의 분산, 각 분포에 대한 비율
Mu = np.array([[-.5, -.5], [.5, 1.0], [1, -.5]])
Sig = np.array([[.7, .7], [.8, .3], [.3, .8]])
P... |
2fa60207e5d0174808e4d7b69adf0067d83674a0 | d4d7d67abdac5f9611890a0ff19a6aae44675d90 | starlegendary/PY-Lang | /lexer.py | Python | py | 2,156 | no_license | import re
def eq(cond, sth1 = True):
if type(cond) == bool: return lambda x: cond
return lambda x: (x == cond) == sth1
def has(cond, sth = True):
return lambda x: (x in cond) == sth
def match(cond, sth = True):
return lambda x: bool(re.match(cond,x)) == sth
def Lexer(r):
alltoken = []
sto... |
87d61e51c7eac354eb6889d51e633015d0cb7967 | 327965b67849f808684d3759318d3a5ec0774a48 | omrachel/e-mission-server | /emission/net/ext_service/push/notify_usage.py | Python | py | 2,067 | permissive | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# Standard imports
from future import standard_library
standard_library.install_aliases()
from builtins import *
import json
import requests
import logging
import uuid
imp... |
bff47b9747ae31bd5d7993200d8f70d86ba205a9 | d6a3c9e17fffdca8de596143b22f3bded876259c | lisiynos/mun_2013 | /submits/22_58_56_23_A_7925.py | Python | py | 303 | no_license | import math
inp = open("abt.in" )
outp = open("abt.out", "w")
#THis is my second problem on Python
n = int(inp.readline())
#a, b = list(map(int, inp.readline().split()))
#print(n, file = outp)
#print(n)
a = int(n / 2)
b = a - 1
if a * b != n:
print("-1 -1", file = outp)
else:
print(b, a, file = outp) |
33bf3e4358a016bec542f491b093483f4f9b4831 | 1f2a3a34bd42c0f332e0a48ec98ed307a72746fb | wsgan001/PyFPattern | /Data Set/bug-fixing-5/5be93156035745e3858b074b50319c69b584e44e-<get_cache>-bug.py | Python | py | 724 | no_license | def get_cache(module):
'Attempt to get the cache object and update till it works'
cache = None
try:
cache = apt.Cache()
except SystemError as e:
if ('/var/lib/apt/lists/' in to_native(e).lower()):
retries = 0
while (retries < 2):
(rc, so, se) = mod... |
be65e9c5c74cbcd3335498d8c385dc4c877a39fc | 22bb74cf680c60e0a526db9ced08f0b4ab998767 | mpreyes/emotion_research_frontend | /detectEmotion/emotion_detection.py | Python | py | 3,853 | no_license |
#django frontend scripts
import os
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Conv2D, MaxPooling2D, Flatten, Reshape
from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img
from keras.applications.vgg16 import VGG16, preprocess_input, d... |
9816958623b3467d175bf4757f467b338557b91c | 9fdca727fb9ef604183cbfdf20ed4e91fcf61948 | wanghaisheng/HuMaIN_Microservices | /OCR/OCRopus/BinarizationService/api/serializers.py | Python | py | 369 | permissive | # -*- coding: utf-8 -*-
from rest_framework import serializers
from api.models import Parameters
class ParameterSerializer(serializers.ModelSerializer):
#image = serializers.ImageField(max_length=None, use_url=True,)
class Meta:
model = Parameters
fields = ('id', 'threshold', 'zoom', 'escale', 'bignore', 'perc',... |
af1b8a98c2eca83a43ae208efd6a6aa5ccffc31b | 4805983bd2cbf96880e65b6a6f6699177bd14ece | Learn1forever/h | /h/services/exceptions.py | Python | py | 358 | permissive | # -*- coding: utf-8 -*-
"""Exceptions raised by :mod:`h.services`."""
class ServiceError(Exception):
"""Base class for all :mod:`h.services` exception classes."""
class ValidationError(ServiceError):
"""A validation problem with a database model."""
class ConflictError(ServiceError):
"""An integrity ... |
a279e233dcb0106ffa0493739ec852f0d8921d2c | d278bed3a44d5bc7f1e6d5c9705c206a81a41e5e | bbcf/pygdv | /pygdv/handler/project.py | Python | py | 9,996 | no_license | from pygdv.model import DBSession, Project, Track, Right, RightCircleAssociation, User, Circle
from sqlalchemy.sql import and_, or_, not_
from sqlalchemy.orm import aliased
from pygdv.lib import constants, checker
from sqlalchemy.types import Boolean
from pygdv.handler import track
DEBUG_LEVEL = 0
def debug(s, t=0):... |
56ea777618f9665a86f191578a312403afc830c5 | 6e22907ee0cf3b61570d3e0c26f370fdbb69553e | markojaadam/face_morpher_memlab | /facemorpher_memlab/morpher.py | Python | py | 6,402 | no_license | """
::
Morph from source to destination face or
Morph through all images in a folder
Usage:
morpher.py (--src=<src_path> --dest=<dest_path> | --images=<folder>) [--background=<bg_path>]
[--width=<width>] [--height=<height>]
[--num=<num_frames>] [--fps=<frames_per_second>]
... |
0ba459b3ccaa2f214b473cfd6f36f63cb3d934e9 | 03a74aec37f61d848279b12400cea4936c004512 | Tasbihzaman/twitterclone-1 | /posts/views.py | Python | py | 1,358 | no_license | from django.shortcuts import render
from django.http import HttpResponse,HttpResponseRedirect
from .models import Post
from .forms import PostForm
from cloudinary.forms import cl_init_js_callbacks
def index(request):
if request.method == 'POST':
form=PostForm(request.POST,request.FILES)
prin... |
67e530bbcabae2962a16820a7457371cc8d2c51b | a373d1b215b174f2f5601b08ff604baa10015a4c | Yondubuntu/codingtest | /미로탈출.py | Python | py | 698 | no_license | from collections import deque
n,m = map (int,input().split())
graph = []
for i in range (n) :
graph.append(list(map(int,input())))
dx = [-1,1,0,0]
dy = [0,0,-1,1]
def bfs (x,y):
queue = deque()
queue.append((x,y))
while queue :
x,y = queue.popleft()
for i in range (4):
... |
1c2ebbfa3d6f0552c3e144efcfde5cfce00261de | 7c3efc6e4ca8598bad24b71ddf15529b20a4e012 | Hawkeye091/Codeasylumshackathon | /notifyme/appone/urls.py | Python | py | 1,161 | no_license | from django.contrib import admin
from django.urls import path, re_path
from django.conf.urls import url
from . import viewsclgs
from . import viewsclgtags
from . import viewsdetails
from . import viewsevents
from . import viewstags
urlpatterns = [
re_path(r'^colleges/(?P<pk>[0-9]+)$',viewsclgs.get_delete_update_clg... |
f8134e099debdcb41724bb880513141f8ceec7d9 | 0f7be7655fb3e7b0c9d70e166a33f045a93088c4 | LongStart/pyproj | /thesis_img/imu_encoder/orientation_from_acc.py | Python | py | 4,053 | no_license | import matplotlib.pyplot as plt
from math import *
x1 = []
y1 = []
imu_t = []
imu_yaw = []
imu_pitch = []
imu_roll = []
sen_t = []
sen_gx = []
sen_gy = []
sen_gz = []
sen_ax = []
sen_ay = []
sen_az = []
sen_gr = []
# acc_yaw = []
acc_pitch = []
acc_roll = []
gyro_yaw = []
gyro_pitch = []
gyro_roll = []
i... |
e90f21d4227e9d385fcc43d4a1ee2a1c17b734e8 | a768155ba7dbf787f55bd47c247aacedd71fc7c4 | mathause/xarray | /xarray/core/indexes.py | Python | py | 53,151 | permissive | from __future__ import annotations
import collections.abc
import copy
from collections import defaultdict
from typing import (
TYPE_CHECKING,
Any,
Dict,
Generic,
Hashable,
Iterable,
Iterator,
Mapping,
Sequence,
TypeVar,
cast,
)
import numpy as np
import pandas as pd
from .... |
89fc7c159ee2bd2c560703ddf47713827560f073 | 041f599535fb9073516fce776e2ea2bd7a0237e2 | esandrea01/Google-IT-Automation-with-Python | /run.py | Python | py | 509 | no_license | import os
import requests
dir = os.listdir('/data/feedback')
dict = {}
key_values = ("title","name","date","feedback")
for file in dir:
f = open('/data/feedback/'+file, "r")
cont = 0
for line in f:
if cont == 0:
dict['title'] = line
elif cont ==1:
dict['name'] = line
elif cont == 2:
di... |
089e8f949507f6655727221f6e3eac9661da7047 | 2659773b43ffcaf362f1d5e6a314e80c6e289d1b | nialov/paperai | /paperai/report/task.py | Python | py | 1,976 | permissive | """
Config module
"""
import os
import yaml
class Task:
"""
YAML task configuration loader
"""
@staticmethod
def load(task):
"""
Load a YAML configuration.
Supports loading from a string or file path.
Args:
task: YAML string or file path to YAML con... |
bfb5536cf181a3c6d9888ad83a672ba2dc3d4173 | 7b55cbb3cafb1a1a10d565e1bed533dc53ec7fc6 | tomisilander/PyNML | /nml/hyptests/propreg.py | Python | py | 2,889 | no_license | #!/usr/bin/python
import math
from nml import regtab, contab
import logmath
def xlogbinoms(n, logs):
lb = 0.0
yield lb
for k in xrange(1,n):
lb += logs[n-k+1] - logs[k]
yield lb
yield 0.0
def logpow(x,n):
if n==0:
return 0.0
elif x==0:
return None
... |
8f8807355f86adcb56cd56070b9722e1e5d96c87 | b3995e7ab657c9de8527d982df627039aa2a3934 | liuguoyou/DCDH-PyTorch | /model.py | Python | py | 5,542 | permissive | import torch
import torch.nn as nn
import torch.nn.init as init
FACE_FEATURES = 1024
class DFHNet(nn.Module):
def weights_init(self, m):
classname = m.__class__.__name__
if classname.find('Conv2d') != -1:
init.xavier_normal_(m.weight.data)
init.constant_(m.bias.data, 0.0)
... |
16843aa1fbc89469c34d3180de4d6184e8a449c1 | 554f2e17232eae062c1a6f7d55941af43e88d5ad | Alvina96/Django | /env/lib/python3.5/site-packages/django/utils/formats.py | Python | py | 9,455 | no_license | import datetime
import decimal
import unicodedata
from importlib import import_module
from django.conf import settings
from django.utils import dateformat, datetime_safe, numberformat, six
from django.utils.encoding import force_str
from django.utils.functional import lazy
from django.utils.safestring import mark_safe... |
a2a38c36d7bbb5bc3cf9c09387885078768313c4 | b5687322c45ef9515c2041207a60ae4a70732a22 | markelotone/BasketballEcommerceStore | /Project/Project557/admin.py | Python | py | 3,537 | no_license |
from flask import Blueprint
from . import db
from .models import Category, Item, Order
import datetime
bp = Blueprint('admin', __name__, url_prefix='/admin/')
# function to put some seed data in the database
@bp.route('/dbseed/')
def dbseed():
category1 = Category(name='Sportswear', image='redshirt.jpg',
... |
77d4d4c756abf7288a351c2fafc07547c945242a | 502679d898b4bcb01f52edefc0451c99c010320f | makart19/daal4py | /setup.py | Python | py | 12,461 | permissive | #! /usr/bin/env python
#*******************************************************************************
# Copyright 2014-2019 Intel Corporation
#
# 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... |
dad126aa0610948b2f3e1e11871a02fadb2e39b0 | 29f0124074e23dad73d1c46f9650b590c9684a7d | devocta/Baekjoon | /2581.py | Python | py | 361 | no_license | def p(n):
num= set(range(2, n+1))
for i in range(2, n+1):
if i in num:
num -= set(range(2*i, n+1, i))
return list(num)
et=p(10000)
et.sort()
M=int(input())
N=int(input())
res=[]
for i in et:
if M<=i<=N:
res.append(i)
elif i>N:
break
if len(res)==0:
print(-1)
else:... |
99e93819f0f73715c6075fe0df9153d9336b57a1 | eb58df6cd9f05eb549788b295d42f9c76fdbe3be | reeddotaer/AI_class_PJ | /test/AI_Gomuku/new_adp/adp.py | Python | py | 6,627 | no_license | from copy import deepcopy
import random
import pisqpipe as pp
from pisqpipe import DEBUG_EVAL, DEBUG
from board_info_helper import check_win, Adjacent, generate_board_value_lists
from CriticNetwork import CriticNetwork
from Debug import logDebug, logTraceBack, DEBUG_LOGFILE
from Board import Board
import pickle
import ... |
c017564474bc8acdf5dc261e94bb3511259eb62a | 23389b56222c5c18a7265f2675457528daa67c9f | google/timesketch | /timesketch/api/v1/resources/story.py | Python | py | 9,982 | permissive | # Copyright 2020 Google Inc. 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 law or a... |
57c8bfb42760995776f2550c94933ae96ea704a0 | 08b6c31b6f3e6f1946499962c2ae112a2953071e | rexhzhang/LeetCodeProbelms | /BuildATree.py | Python | py | 1,665 | no_license | from collections import deque
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class BuildTree(object):
def __init__(self, data: list):
self.data = iter(data)
def build(self):
try:
... |
bad42d41b90c6d0c1c0dcfb855a109e553a99ae4 | 56460d00076d770fc8c97bd26ea823d6355b3122 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_155/2467.py | Python | py | 601 | no_license |
f = open("a.in", "r")
data = f.read().split("\n")[1:]
f.close()
if data[-1] == "": data = data[:-1]
data = [d.split(" ")[1] for d in data]
fout = open("a.out", "w")
for i in xrange(len(data)):
c = 0
s = 0
for needed in xrange(len(data[i])):
howManyToSumIfEnough = int(data[i][needed])
if needed <= c:
c +=... |
f8b7b40582f74e46bae4c5760b8d2e969bca35a3 | ca7bab712c214a56bee3123aa3263e82fd21559e | hitov/py-physics | /vector.py | Python | py | 5,443 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# untitled.py
#
# Copyright 2012 Angel Hitov <bango@bango-desktop>
#
# 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 Softwa... |
085d4538130b7ed13764d94a54dee1c17251f5b3 | d1b7ea95bbbee112ff69a5084a6fbd7b4c0578a5 | asoral/recruitment | /recruitment/recruitment/doctype/document_custodian/test_document_custodian.py | Python | py | 212 | permissive | # -*- coding: utf-8 -*-
# Copyright (c) 2019, VHRS and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestDocumentCustodian(unittest.TestCase):
pass
|
9bc3fd694acd619fec1fceb70b922926e71a3d1a | b1cfc71788169e0b03deefc3a528c5c125d76df6 | sandeez/lino | /lino/modlib/__init__.py | Python | py | 1,036 | permissive | # Copyright 2008-2016 Luc Saffre
# License: BSD (see file COPYING for details)
"""The standard model library included with Lino.
A collection of ready-to-use plugins (Django calls them "apps") for
Lino applications.
"System plugins"
================
.. autosummary::
:toctree:
gfks
system
lino_startu... |
f4fa9951137d5417b854797acccb274ecb4099f0 | 9151cb72597d568f8c381926fea7e5455fab2998 | xiao0095/DVERGE | /train/train_baseline.py | Python | py | 5,606 | no_license | import os, sys
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
sys.path.append(os.getcwd())
import json, argparse
from tqdm import tqdm
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
import arguments, utils
from models.ensemble im... |
0cff6cfb0a899f378fe4f56116e4ef2950f57b8c | db7ff195cbe77395ec54d135a19dbbfb023b0437 | nikeshthapa255/RestroPlaza-django | /restaurant/migrations/0003_auto_20190726_1330.py | Python | py | 484 | no_license | # Generated by Django 2.2.3 on 2019-07-26 08:00
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('restaurant', '0002_dishes'),
]
operations = [
migrations.AlterField(
model_name='dishes',
... |
6154429b8a2d604505803dfba0f69520f2e0dcce | 8ba39591447a25e2e03e82bf17a17ce98dd036e6 | rospypi/simple | /cv_bridge/setup.py | Python | py | 270 | permissive | #!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup()
d['packages'] = ['cv_bridge', 'cv_bridge.boost']
d['package_dir'] = {'' : 'python'}
d['version'] += ".post1"
setup(**d)
|
e262f7053bc3223a819a8c3438ab14d449e79195 | 4ce3e4b60d1ce929e418287dfa7214666e3d3587 | debakun12/blog21 | /cardgame/feed/migrations/0004_alter_feed_display_photo.py | Python | py | 401 | no_license | # Generated by Django 3.2.4 on 2021-06-21 14:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('feed', '0003_alter_feed_display_title'),
]
operations = [
migrations.AlterField(
model_name='feed',
name='display_ph... |
438facb73d2cd844ba5e99afeef6a8cc3abf5f91 | 39ae1e65419eb7e826fe502b1d7270009c7ce67e | mvendra/mvtools | /git/visitor/interfaces/gipul_offline_only_all_branches.py | Python | py | 468 | permissive | #!/usr/bin/env python3
import sys
import os
import path_utils
import git_visitor_pull
def puaq(): # print usage and quit
print("Usage: %s repo_path." % path_utils.basename_filtered(__file__))
sys.exit(1)
if __name__ == "__main__":
if len(sys.argv) < 2:
puaq()
options = {}
repos = []
... |
528e39dd094e289cf92d860e69dbac9b87c91294 | fb90f34a4cb904bffb1199a7adc94a491200601b | gordonjun2/CenterTrack | /src/AIC2018_iamai/ReID/ReID_CNN/utils.py | Python | py | 22,793 | permissive | import os
import glob
import sys
import torch
from torch.autograd import Variable
from torch.utils.data import Dataset,DataLoader
from torch.utils.data.sampler import SubsetRandomSampler
from torchvision import transforms
from torchvision.transforms import Compose,Resize,ToTensor
from PIL import Image,ImageEnhance
impo... |
6ade81340acb9bce1198a62928c56cedf6d394bd | 8535a68906a55c5bb7df4fe5854dc9f84c92f3cc | wsgan001/PyFPattern | /Data Set/bug-fixing-5/72c96b3ac30ad17fad3dda69836478fd1e54492d-<extract_contents>-fix.py | Python | py | 680 | no_license | def extract_contents(args, path, output_dir):
if (not args.test):
with open(path, 'r') as json_fd:
items = json.load(json_fd)
for item in items:
contents = item['contents'].encode('utf-8')
path = ((output_dir + '/') + re.sub('^/*', '', item['path']))
... |
becee8f5fc0d691625660ffd6e9364cca34e6b30 | 964aa7687a447a5e3a8bc7bf9c4d5ab136400386 | ekmolloy/retrosim-study | /summary/plots/figure-5/plot_errrs.py | Python | py | 3,669 | no_license | import numpy
import pandas
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from matplotlib import rc
import sys
plt.rc('text', usetex=True)
plt.rcParams['text.latex.preamble'] = [r'\usepackage{helvet} \usepackage{sfmath}']
fig = plt.figure(figsize=(7.5, 3))
gs = gridspec.GridSpec(1, 2)
ax0 ... |
26879976c1b9f0814f3b7727bc2ed770d9e01527 | a93468f77e324bc90b87bfa6db156405484b56a5 | qilin-link/test | /test/tkinter/Frame控件.py | Python | py | 782 | no_license | #!/usr/bin/env python
#_*_ coding:utf-8 _*_
import tkinter
#创建主窗口
win = tkinter.Tk()
#设置标题
win.title('Test')
#设置大小和位置
win.geometry('400x400+500+200')
'''
框架控件
在屏幕上显示一个矩形区域,多作为容器控件
'''
frm = tkinter.Frame(win)
frm.pack()
#left
frm_1 = tkinter.Frame(frm)
tkinter.Label(frm_1, text='左上', bg='pi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.