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 |
|---|---|---|---|---|---|---|---|---|
cfed395fcf7baf0a704c7b53c4a82b482726f607 | d2d071b6b9c43b4e87d469e37f1368353c13fccd | hickeye/chainer | /chainer/functions/loss/negative_sampling.py | Python | py | 6,667 | permissive | import numpy
import six
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class NegativeSamplingFunction(function.Function):
def __init__(self, sampler, sample_size):
self.sampler = sampler
self.sample_size = sample_size
def _make_samples(self, t):
... |
59c51426dac7d521ad2c9256320e02ef52a79ddd | 90c509e4724bfc1675f54cb8ead5d0af44e829a4 | qiuchenqqb/tp091 | /examples/HED/hed.py | Python | py | 11,070 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: hed.py
# Author: Yuxin Wu
import argparse
import numpy as np
import os
import cv2
import tensorflow as tf
from six.moves import zip
from tensorpack import *
from tensorpack.dataflow import dataset
from tensorpack.tfutils import gradproc, optimizer
from tensorpack.... |
e8f1c2c939d7ad58e5a96ac042b1101ddc6f4ba3 | e81c3e0686bbb1e8b7a000d7d0df572e887d999d | time-consume/Python-Crash-Course | /Chapter 7/my letter.py | Python | py | 8,417 | no_license | print("如你所说,我昨天失控了,这一定伤害到你了,对此我深感抱歉。基于你现在的感受,你可以选择读我写的其中一封信:如果你已经不爱我了请看信A,如果你还爱我请看信B。")
message=input("please enter a or b: "+"\n\n\n")
if message=='a':
print("信A"+'\n'+"亲爱的莹莹:"+"\n"+
"和你在一起度过的半年里是我人生中最愉快的时光,我现在仍记得一开始和你约会时候紧张而憧憬的心情,我很清楚这种感情是真实的喜欢。我也很享受现在每周我们有固定的时间和共同的活动,我喜欢你在我身边时感受到的安逸和满足,我知道这种感觉是真实的幸福。我也憧憬将来我们在一起的时光... |
b788508ef22403c30237419204abf9ee74cef233 | 62252fd71efbfa220313ea71210621286ce2366b | epartington/mrichardson03.panos | /plugins/modules/panos_op.py | Python | py | 4,158 | permissive | #!/usr/bin/python
# Copyright 2020 Palo Alto Networks, Inc
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND T... |
6bdeadefb4e8d9df511e2f6c68bd87f3a8f90c13 | a00a20f64f1ba272a5fa1a32924ef80ab3d312b2 | EverythingSmartHome/core | /homeassistant/components/intellifire/climate.py | Python | py | 3,883 | permissive | """Intellifire Climate Entities."""
from __future__ import annotations
from homeassistant.components.climate import (
ClimateEntity,
ClimateEntityDescription,
ClimateEntityFeature,
)
from homeassistant.components.climate.const import HVACMode
from homeassistant.config_entries import ConfigEntry
from homeas... |
7eae379ae211ca59748f12a6ab659026746a863b | d9ee4ef21b267396cb62fa4754d60273f3ff024e | Sharu15/Trip | /TripD/urls.py | Python | py | 1,741 | no_license | # """myblog URL Configuration
# The `urlpatterns` list routes URLs to views. For more information please see:
# https://docs.djangoproject.com/en/2.1/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'... |
593ba82821bb6f481ade10b75acfe1a54495fd34 | ca3a2f130e4e160445988dc66a9195ebb3198722 | Ersandeep977/Project_full_task_Django | /kahi/file_download_app.py | Python | py | 4,319 | no_license | import requests
import json
import shutil
from Crypto.Cipher import ARC4
#url = 'http://127.0.0.1:8000/'
url = 'https://limitless-bayou-79939.herokuapp.com/'
user = ''
def check_user_exists(username, password):
payload = {"username": username, "password": password}
headers = {'content-type': 'application/js... |
2be2871e3459d6ba5aae770ff9b7c5f1901f21ef | 824020cf6edd626cc494cdca5140b2b75721a186 | RajashreePP/Basic-Programming-using-Python | /whileEx.py | Python | py | 222 | no_license | from pylab import *
#printing numbers from 0 to 1 for n inputs
n=int(input())
dx=1.0/(n-1)
x=0.0
while x<(1.0-dx/2):
print(x)
x+=dx
print(1.0)
#OR
import numpy as np
print(np.linspace(0,1,n))
|
f2d4ffd7af3a35271f1894819b40badbbc7d0c1d | a703a1d1526bd3beb652f62c4e08db1409968080 | dskslep/openai_gym | /agent_templates/base.py | Python | py | 3,994 | no_license | import json
from abc import ABC, abstractmethod
from collections import defaultdict
from random import choice
import numpy as np
class Greedy(ABC):
def __init__(self, epsilon, num_actions):
self.epsilon = epsilon
self.num_actions = num_actions
self.prev_action = None
self.prev_st... |
af3516b89265e8018ffeb2ce9146ad6a96713560 | 8ccbc873a9d9ebb3d39e90dd7ff3fbe8d66189cf | SimuJenni/CorrepondenceMatcher | /datasets/ImageNet.py | Python | py | 2,824 | no_license | import tensorflow as tf
from Dataset import Dataset
from constants import IMAGENET_TF_256_DATADIR
slim = tf.contrib.slim
class ImageNet(Dataset):
SPLITS_TO_SIZES = {'train': 1281167, 'validation': 50000}
ITEMS_TO_DESCRIPTIONS = {
'image': 'A color image of varying height and width.',
'heigh... |
946c8c34c3bb2f7ab4cfa79e92ec7ad4fc760ed8 | d8504728400365434cbe725661f0b8738a2aa428 | jovindrc/Python-Projects | /Password Generator.py | Python | py | 453 | no_license | #!/usr/bin/env python
# coding: utf-8
# To write a Python program to create a password, declare a string of numbers + uppercase + lowercase + special characters. Take a random sample of the string of a length given by the user:
# In[1]:
import random
password = int(input("Enter the length of password:"))
s="abcdefg... |
58bc211c6bacbce872deceaa169772a4c8c59630 | 1a1470ae06a8f8d9a9cbdaf057251e53d0c04cd2 | lishali/auto-hashtags | /transformer/src/train.py | Python | py | 10,531 | no_license | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import time
import os
from six.moves import cPickle
import opts
import models
from dataloader import *
import eval_utils
impo... |
fe095ba914e7c6f3f3919193937cf4175fb33df9 | 40accf8f82605c005e56a5e22e9fb34fe5d758d3 | ChiragBhalgami/tests | /tests/sqlqa/tests/create_gtables/cmureg/uw08_ddl.py | Python | py | 6,821 | permissive | # @@@ START COPYRIGHT @@@
#
# (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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... |
3c78cf742021127d2a667fe53b6dc0e5e6a1fcdf | d25cb3fd32b7633613323994b081ae1c14b9eeca | pchobeau/sinecity_testcases | /tools/pe_absorbing_layer.py | Python | py | 4,935 | permissive | # -*- coding: utf-8 -*-
##
# \file pe_absorbing_layer.py
# \title Definition of an absorbing layer for the parabolic equation.
# \author Pierre Chobeau
# \version 0.1
# \license BSD 3-Clause License
# \inst UMRAE (Ifsttar Nantes), LAUM (Le Mans Université)
# \date 2017, 20 Nov.
##
import numpy as np
... |
22b526641b9c38b79467027a4d6ed95dbbf15fe6 | 713ff3f8997b45258bfd160f52a04eea7632bec5 | semyont/influxdb-client-python | /influxdb_client/domain/ready.py | Python | py | 4,032 | permissive | # coding: utf-8
"""
Influx API Service
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: 0.1.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class Read... |
2b85723b7daeab80cf1589c930816813966019ea | ef1e526d2dd1c7e3a869e5f3dca24bb1f0158768 | floricamatei/workfmi | /teme-facultate/lfa/proiectcompilator/regex2dfa.py | Python | py | 3,030 | no_license | '''
2. Sa se scrie un program care primeste la intrare elementele unei expresii regulate (alfabetul expresiei,
expresia propriu -zisa (in forma prefixata sau infixata - adica forma naturala), care contine 3 tipuri de operatori:
reuniune, concatenare si iteratie Kleene (*)). Sa se determine un automat finit determinist ... |
762c932293f62fc57b54db956f37c56281e6d579 | 51066c2c05b39ac83a1e78e6a6bf7f6f4379d5fb | martinbeier/side-channel-analysis-toolbox | /tests/attack/test_sa_integration.py | Python | py | 2,010 | permissive | import unittest
import numpy as np
import progressbar # This actually imports progressbar2 but `import progressbar2' itself doesn't work. Weird package.
from sca.attack import sa
from sca.loghandler.loghandler import LogHandler
class TestSaIntegration(unittest.TestCase):
def test_solve_single_subkey(self):
... |
eb45ae14c54625650495922960e42e66bf471a8a | e6160d99384032f916a66c82f6e50571eddf78b2 | cyrilbecot/DibosonBSMSignal_13TeV | /gridpack_folder/mc_request/LHEProducer/Spin-2/RSGraviton_ZZ_inclu/RSGraviton_ZZ_inclu_narrow_M4000_13TeV-madgraph_cff.py | Python | py | 773 | no_license | import FWCore.ParameterSet.Config as cms
# link to cards:
# https://github.com/cms-sw/genproductions/tree/527596440ac4152751ef21a01e90cc2b5f8cfcb9/bin/MadGraph5_aMCatNLO/cards/production/13TeV/exo_diboson/Spin-2/RSGraviton_ZZ_inclu/RSGraviton_ZZ_inclu_narrow_M4000
externalLHEProducer = cms.EDProducer("ExternalLHEPro... |
30762b1acca94d10d02f0141ebd549b2f53f67f4 | be1a37a596c8d1565442956f763cdfbe301e1121 | zanzydnd/quiz | /src/api/views.py | Python | py | 3,670 | no_license | import json
from datetime import datetime
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework.permissions import IsAdminUser, AllowAny
from django.contrib.auth import get_user_model, authenticate, login
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db... |
dcd37593581e816f2b6a984a793825a73d05ae35 | 462116632ea2a1812b21b399362b703dd5921eca | vietanhdtd/not-your-car-backend | /migrations/versions/52801ce2d1b7_.py | Python | py | 1,749 | permissive | """empty message
Revision ID: 52801ce2d1b7
Revises: 6c6c050b123c
Create Date: 2019-07-15 17:13:56.946305
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = '52801ce2d1b7'
down_revision = '6c6c050b123c'
branch_labels = None
depends_on = None
... |
b6c42970e4615d4575ee1526b575f1a892a926cf | 46794e9d0f4b653944f15df2b249089db1841b27 | arkaprovaz/ln379_Delenitors | /api_codes/mqtt_subcriber.py | Python | py | 1,633 | no_license | import paho.mqtt.client as mqtt
import time
import json
from CRUD import pushToDB
mqtt_config = "jsons/mqtt_config.json"
with open(mqtt_config, 'r') as openfile:
config = json.load(openfile)
mqtt_sub_topic = config["topic"]
client = mqtt.Client()
def on_connect(client, userdata, flags, rc):
client.connect... |
6795ce3512554602e3de3751fbf1849dee428b9a | 586f0fdfbd15479373de72daab4fa35d9b532675 | gennari/patrolling_sim | /start_experiment.py | Python | py | 11,818 | no_license | #!/usr/bin/env python
#
import Tkinter as tk
import tkMessageBox
import ConfigParser
import thread
from Tkinter import *
from ttk import *
import Image, tkFileDialog
import numpy as np
import sys, time, os, glob, shutil
from math import atan2, degrees, radians
import datetime
Alg_names = [
[ 'RAND', 'Random... |
17eeb3c0ae04018c89f9724bae65d2eeb6a74e9e | 75065b5f7ea0a77de2769fa209fe6783f0f34917 | ngocyen3006/learn-python | /Guru99/fibonacci-loop.py | Python | py | 227 | no_license | n = int(input())
def fib(n):
if(n == 0 or n == 1):
return n
a = 0
b = 1
i = 2
while(i <= n):
i = i + 1
S = a + b
a = b
b = S
return b
re = fib(n)
print(re)
|
483c334d01198628e99f5d4f5818060b4a416f51 | c13640ac2fa2064876a18863dc7983ecb9f37f25 | Stevenholloway/SHARE | /providers/org/shareok/migrations/0002_favicon.py | Python | py | 451 | permissive | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2017-02-01 21:23
from __future__ import unicode_literals
from django.db import migrations
import share.robot
class Migration(migrations.Migration):
dependencies = [
('org.shareok', '0001_initial'),
('share', '0018_store_favicons'),
]
... |
16fe2859a21258037a78ae0c8fe7fd4ac43169a0 | 61875c289842512b832a34a2df6dca8f6806598f | springwindyike/dbm-agent | /setup.py | Python | py | 1,656 | no_license | import os
import re
from setuptools import setup
def get_version():
"""
提取出 dbma/version.py 中的 agent_version
"""
base = os.path.dirname(__file__)
version_file = os.path.join(base, 'dbma/version.py')
with open(version_file) as f:
line = f.readline()
m = re.search(r'\d\.\d\.\d*', l... |
6ce66dc3b5a650b1c2347c66a47d90c462fe5f00 | 645d7c0a14fc5428028adcd9e525d65eb34c7413 | thenicopixie/holbertonschool-higher_level_programming | /0x11-python-network_1/0-hbtn_status.py | Python | py | 331 | no_license | #!/usr/bin/python3
"""fetch URL module"""
import urllib.request
with urllib.request.urlopen('https://intranet.hbtn.io/status') as response:
html = response.read()
print("Body response:")
print("\t- type: {}".format(type(html)))
print("\t- content: {}".format(html))
print("\t- utf8 content: {}".format(html.decode(... |
e6d284a8764f17a75826dae21c7015e54bf6bf11 | 538974670aec2829ad1afa3e6497818efaa5b158 | ImSEten/IEEEPythonTest | /PythonTest/PythonTest.py | Python | py | 4,766 | no_license | #!F:\PyCharm-projects
# coding : utf-8
# author : 葛壮壮
import tensorflow as tf
#from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
import os
import scipy.misc
def model_test(filename):
output='./TestImage/'
if not os.path.exists(output):
os.makedirs(output)
#input='TFcodeX_10.t... |
3524bf4701577faa0d40b5209aae0cb9dbafcca3 | a4617b73a193a5300cb3dfabe6b5fe46f92a769e | lilongabc/actual-17-homework | /01/yanggongwang/list_sort.py | Python | py | 326 | permissive | #coding=utf-8
# 作者:杨公旺
# 时间:2017-11-27
list = [1,2,3,2,12,3,1,3,21,2,2,3,4111,22,444,111,3333,4,5,777,65535,45,5001,33,45,6000]
for i in range(0,len(list)-1):
for j in range(i+1,len(list)):
if list[i] < list[j]:
temp = list[i]
list[i] = list[j]
list[j] = temp
print list
|
e446c84aa01e6c97f5c2a7e316dfb66243f872b3 | 42e41432e4e54fc21ae3bb4ca2600e8b6a94522c | MDK1192/Big-Data-Consulting-Shiny | /Dashboard_EmotionDetection/skript_audio_class.py | Python | py | 3,134 | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 5 11:05:46 2020
@author: Marc
"""
# Imports here
import tensorflow as tf
import matplotlib.pyplot as plt
import pandas as pd
import torch
import json
import os
from torch import nn
from torch import optim
import numpy as np
from PIL import Image
from torchvision import ... |
b42ea2fa53cf554e81cf9b13aa30ec18998c1d9c | 725b0f07ce71fa0ea98ae7343f0dbf47adda3ebb | open-mmlab/mmpretrain | /configs/cae/cae_beit-base-p16_8xb256-amp-coslr-300e_in1k.py | Python | py | 3,138 | permissive | _base_ = '../_base_/default_runtime.py'
# dataset settings
dataset_type = 'ImageNet'
data_root = 'data/imagenet/'
data_preprocessor = dict(
type='TwoNormDataPreprocessor',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],
second_mean=[-31.875, -31.875, -31.875],
second_std=[318.75, 318.7... |
eb6b41c95addab71b75475ec36d04ce8401e5a02 | 7262cefa80d4c58179bdfb5a734f9b62d3c2d7d2 | devla-d/ecormernce | /accounts/models.py | Python | py | 1,958 | no_license | from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
class MyAccountManager(BaseUserManager):
def create_user(self,username, email, password=None):
if not email:
raise ValueError('email is required')
if not username:
raise Va... |
876bf63e6f0a1bac2440a342232ffdff60fbe155 | e307198e4db4172da83bc0766b1599d3aae14bfc | ruebe5w/funktioniert-e | /main.py | Python | py | 2,021 | no_license | import requests
import json
import time
import mysql.connector
#variable
token = ''
wiederholungen = 10
times = []
#einlesen des Tokens
fobj = open("token.dat")
for line in fobj:
token = line.rstrip()
fobj.close()
headers = {'Content-Type':'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer ... |
139420860a83fca23574edbb919672e5bc6ef538 | cc87d63dc0358bde095ab587123c6622d2c6868d | Cope-Ali/CS241 | /braces.py | Python | py | 1,544 | no_license | """
File ds05.py
Author: Ali Cope
This is an excercise in how to use Lists as Stacks for python.
This program will read a file, enter the contents into a list
and determine if the braces in the file are balanced.
"""
stack = []
def test(brace):
if len(stack)>0:
top = stack.pop()
if top... |
9d9d7ac01d6be7f6edc7590e73f228c6c4c35e92 | 03e64735dbc4d15217c42bdf161d580339c8ac00 | qiyeboy/bloomfilter | /bloomfilter/bloomfilter.py | Python | py | 4,154 | permissive | # -*- coding: utf-8 -*-
"""bloomfilter
1. ``import bloomfilter``.
2. Mark your own hash functions with ``@bloom_hash``.
3. Instantiate a ``BloomFilter``.
4. Use ``bloom_filter[key]`` to query and ``bloom_filter[key] = True`` to set.
"""
from bitarray import bitarray
from functools import update_wrapper
class BloomF... |
d181c6f657446b4aedf325c6c0ae5fd0bff061cb | 183bc1429fcfefaeaad2d335666dbfdf4f48ef5f | yang8456211/Atany_Blog | /my_site/Atany_Web/article/migrations/0001_initial.py | Python | py | 782 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Article',
fields=[
('id', models.AutoField(prim... |
729e55cf49510ae0f1d0609764522e40f7c10112 | 18da77844f7f7a1f3554e28035214dcb3c0c5cd5 | KonradOliwer/Ferro_Caelum | /hero_creator/views.py | Python | py | 4,625 | no_license | # coding: utf-8
from django.http import HttpResponse
from django.template import Context, loader
from hero.models import *
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from user_profile.models import UserProfile
from django.core.urlresolvers import reverse
from dj... |
4e67c9787446f4c21c1dc42f89dc3b75a9dd7a0b | d940927b818d22534a0b9d8b9b7c4255ad96d2ff | sahariardev/udemy_pyspark_taming | /src/age_average.py | Python | py | 703 | permissive | from pyspark import SparkConf,SparkContext
def parse_txt(line):
tokens=line.split(" ")
age=int(tokens[1])
number_of_friends=int(tokens[3])
#print("I am here")
#print((age,(number_of_friends,1)))
return (age,number_of_friends)
def result(x,y):
return (x[0] + y[0],x[1] + y[1])
conf=SparkConf... |
41abde43d3b1f6c5b2b46171a46c84014a1a9808 | d08129f06849fc1cb8f6ee2c2fb14bf7e101a8c2 | DaronP/Lab3 | /SR1.py | Python | py | 5,548 | no_license | import struct
from collections import namedtuple
def char(c):
return struct.pack("=c",c.encode('ascii'))
def word(c):
return struct.pack("=h",c)
def dword(c):
return struct.pack("=l",c)
def color(r,g,b):
return bytes([b,g,r])
class Bitmap(object):
def __init__(self, width,height):
self.width ... |
0158ae68f23c78e9fa525a224af21ff09a342681 | e61a5de5b1249a32803c09255d138a00b2762e6a | moe-lok/HPYieldReportingApp | /HalfInch/HVIEUI.py | Python | py | 18,008 | no_license | import tkinter as tk
from tkinter import StringVar, messagebox, BOTH, LEFT, BOTTOM, RIGHT, TOP, X, END, Y
from tkinter.ttk import Frame, LabelFrame, Label, Entry, Button
import datetime
from copy import copy
from openpyxl import load_workbook
from openpyxl.formula.translate import Translator
from tkcalendar import Dat... |
2548a61e572f297a2ba66aa0423c121420ca28d4 | 74ef9089ac445a7e2dc399b1e604224915352b0a | Sellberg-lab/hummingbird | /src/interface/data_source.py | Python | py | 9,905 | permissive | # --------------------------------------------------------------------------------------
# Copyright 2016, Benedikt J. Daurer, Filipe R.N.C. Maia, Max F. Hantke, Carl Nettelblad
# Hummingbird is distributed under the terms of the Simplified BSD License.
# ----------------------------------------------------------------... |
dbb945e7a7ee8c6bd0bf6719eb256784cd645922 | d7785d1a0704b906b9f8cd82db153deb5baecbb7 | Mcoconan/Transformations | /Engine3D.py | Python | py | 266 | no_license | from gl import Render, color, V2, V3
from obj import Obj, Texture
import random
r = Render(1000,1000)
t = Texture('./models/model.bmp')
r.loadModel('./models/model.obj', V3(500,500,0), V3(300,300,300), t)
r.glFinish('output.bmp')
#r.glZBuffer('zbuffer.bmp')
|
40287c5ba74d066a6437dd761a93d9ede7e1f323 | 774c3918b6ec7e7e99a504cba95b665af2ea8cf1 | The-Intelligence-of-Information/flax | /tests/core/frozen_dict_test.py | Python | py | 2,606 | permissive | # Copyright 2021 The Flax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
00b4750fa86f9d41a6893dc7d3c55e4fa4a528cf | b001309f32907a19629fd7f81d58d9c95d1bc202 | Suwailem1/electricitymap-contrib | /parsers/AM.py | Python | py | 6,161 | permissive | import re
from datetime import datetime
import arrow
import requests
from bs4 import BeautifulSoup
from dateutil import parser as dparser
from dateutil import tz
# URL of the power system summary: http://epso.am/poweren.htm
# URL of the detailled SCADA-page: http://epso.am/scada.htm
POWER_PLANT_MAPPING = {
"var ... |
dde108b8557338a8bbc902fbd90ae9f01595bdd0 | 0a4954dbb3d8fbf8f23504c965d18d497ed1d043 | houjunchen/hands-on-keras | /dnn/answer/07_earlyStopping.py | Python | py | 2,134 | no_license | #coding=utf-8
''' Import theano and numpy '''
from __future__ import print_function
from past.builtins import execfile
import numpy as np
execfile('00_readingInput.py')
''' EarlyStopping '''
from keras.callbacks import EarlyStopping
early_stopping = EarlyStopping(monitor = 'val_loss', patience = 3)
''' set... |
b1959295bb388702784da1e3b1eddb88de2b7063 | 4e78aeb83e0a8608a4d26100dd40222f32ebf4d6 | shilinlun/Pytorch-Object-Detection | /YOLOv1/train.py | Python | py | 8,577 | no_license | from torch.utils.data import DataLoader
from Constant.Config import config
import torch
import numpy as np
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torch.optim as optim
from tqdm import tqdm
from torch.autograd import Variable
from nets.yolo1train import Train
from nets.yolo_resnet import yo... |
d8a5a56e25732cae6f6c73e752aa957bbb2532e7 | 1370dcbf43443103881043d41f297b5648c050e2 | Shaik-Nayeem/Foodie-Django-App-Python | /Profile/Profile/settings.py | Python | py | 4,770 | no_license | """
Django settings for Profile project.
Generated by 'django-admin startproject' using Django 1.11.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import o... |
e1ca9f394e0b8c46277ea0ece22907f49c892350 | 46eb74ad02b473f601bd274c66cc6de82cb37de9 | madawaladw/DW-Python3Scripts | /Protocol Headers/The_Ethernet_Header.py | Python | py | 958 | no_license | #!/usr/bin/env python3
# ETH_P_IP = 0x0800 # ternet Protocol packet
import socket
import binascii
import struct
class the_ethernet_header:
def __init__(self, destination_mac, source_mac, ethernet_protocol):
self.destination_mac = destination_mac
self.source_mac = source_mac
self... |
689e4eb4238a8c4e6ccde1c807db60ba5a8beb89 | 6551377c70b5d12bab73b44a980f4cbdd6c506a2 | lensabillion/CS487 | /two-city-scheduling.py | Python | py | 801 | no_license | class Solution(object):
def twoCitySchedCost(self, costs):
"""
:type costs: List[List[int]]
:rtype: int
"""
N = len(costs)//2
ans = 0
diffa, diffb = [], []
for cost in costs:
if cost[0] < cost[1]:
ans += co... |
ffbaf308c0628d49acf2430c6d9d9c08ca26ef5b | db6ca232b3ca0513bc0e86df3fbf515144350457 | Preston-Young/BlackJack | /Game.py | Python | py | 22,681 | no_license | from Player import Player
from Dealer import Dealer
from Cards import Cards
from Scoring import Scoring
class Game:
# Constants for min bet, max bet, payout as a string, payout as a float, and when to shuffle
MINBET = 20
MAXBET = 500
BLACKJACKPAYOUTSTR = '3:2'
BLACKJACKPAYOUT = int(BLAC... |
d78afa78aa2bce190a9caf4c6a748f6b9014b1e0 | 336f95c4bf28ca1650e910c61e09b4b97affd560 | rdujardin/icforum | /icforum/forum/admin.py | Python | py | 1,087 | permissive | # Copyright 2016 Infinite Connection
#
# 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 w... |
cda16737ea708612d24d88495b2aed7b7527f38a | b345f777d5cc6d43343a08a512f9d2d110214b89 | mmattisinschool/doob | /cogs/ping.py | Python | py | 708 | permissive | import discord
from discord.ext import commands
doob_logo = "https://cdn.discordapp.com/avatars/680606346952966177/ada47c5940b5cf8f7e12f61eefecc610.webp?size=1024"
class ping(commands.Cog):
def __init__(self, client):
self.client = client
# Ping command, gives latency of the bot to the user.
@comm... |
5e7f8349ae80227a481ef02d74f77aba3e716c18 | becec1b7daf63da06db211e74669747432034fa6 | aurule/npc | /tests/test_npc/test_db/test_query_builders/test_character_lister_query_builder/test_group_by.py | Python | py | 363 | permissive | from npc.db.query_builders import CharacterListerQueryBuilder
def test_records_group_criterion():
builder = CharacterListerQueryBuilder()
builder.group_by("org")
assert "org" in builder.grouped_by
def test_increments_index_last():
builder = CharacterListerQueryBuilder()
builder.group_by("org")
... |
d0b2c911e114e19b13c22085c7104dba51f2e07a | cdace52092fbc0947b17d41e8363d2acae12f84e | byung-u/HackerRank | /ProjectEuler_plus/euler_053.py | Python | py | 965 | permissive | #!/usr/bin/env python3
from math import factorial
from functools import reduce
def combination_calc(n, r):
nums = [i for i in range(n, n - r, -1)]
numerator = reduce(lambda x, y: x * y, nums)
denominator = factorial(r)
return numerator // denominator
N, K = list(map(int, input().strip().split()))
to... |
d31f5b2e7275b398d607d87cbdead0f3e97c13c8 | cdb1ad2dfe55ddcacd92b22092639ea279b957e1 | Shuo-Shi/Python_learning | /29_collections_OrderedDict.py | Python | py | 1,470 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import OrderedDict
class LastUpdatedOrderedDict(OrderedDict):
def __init__(self, capacity): # capacity:容量
# 调用父类OrderedDict的构造函数,下面要用到父类的popitem等方法
super().__init__()
self._capacity = capacity
def __setitem__(self,... |
d24c385a33c008df3c4923062a5e17b4a127ffa7 | 199af64927d577670cc64b53a82a686fd905be36 | k0kishima/machine_learning_hands_on | /keiba_machine_learning/netkeiba/models.py | Python | py | 1,074 | no_license | import os
from typing import IO
from keiba_machine_learning.models import Race as Base
from keiba_machine_learning.netkeiba.constants import DATABASE_PAGE_BASE_URL, RACE_DATA_DIR, ENCODING_OF_WEB_PAGE
class Race(Base):
def __hash__(self) -> int:
return int(f'{self.year}{self.race_track.value:02d}{self.ser... |
0064849903383395e0084420aae8a3619ce7f715 | d55ec37ed507f456e9d3ab529e8d70fa127ed9b6 | SergeGreyD/Coffee_Machine | /Coffee Machine/task/machine/coffee_machine.py | Python | py | 5,156 | no_license | # Write your code here
# First, read the numbers of coffee drinks from the input
# number_coffee_cups = int(input('Write how many cups of coffee you will need:>'))
water = 400
milk = 540
coffee_beans = 120
disposible_cups = 9
money = 550
balance_espresso_water = 250
balance_espresso_coffee_bean = 16
balance_espresso_mo... |
c31b51498196c0a0e7a3b716050be18e448ef86c | 762725325c6b3b540e413cd888474a3072a58b85 | cisco/opentelemetry-python-contrib | /sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/_lambda.py | Python | py | 2,413 | permissive | # Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
9793bf4de515a02263c1ba221d2410d6f0b4c442 | 9970324197a5991823544822f793937e7c828c02 | Aasthaengg/IBMdataset | /Python_codes/p02852/s888061853.py | Python | py | 392 | no_license | from heapq import heappush, heappop
N, M = map(int, input().split())
s = input()
q = [(0,N)]
INF = 10**9
dic = {}
for i in range(N-1, -1, -1):
cnt, j = q[0]
while j-i>M:
heappop(q)
cnt, j = q[0]
heappush(q, (cnt,j))
cnt += 1 if s[i]!='1' else INF
heappush(q, (cnt,i))
dic[i] = j
if cnt>=INF:
print... |
73227ed2a47ba92253a4380b917f36e814862b6b | 9bddb9198d208d203504c36d84c5975a9d20bb66 | Amadiro/devilry-django | /trix/apps/trix/restful/topicstats.py | Python | py | 3,314 | no_license | from devilry.restful import restful_api, RestfulView, RestfulManager
from devilry.restful.restview import extjswrap
from devilry.restful.serializers import SerializableResult, ErrorMsgSerializableResult
from django.db.models import Count, Sum
from django.http import HttpResponseBadRequest
from trix.apps.trix.models i... |
7d228239cfeec57228a5e79764c4dadc41b8226f | 5ec5705e7fd42bf371fcc8c02938353078d3d4b7 | SamridhiGusain/missionary-cannibal | /mncdebug.py | Python | py | 4,345 | no_license | #%%
import copy
import sys
visited=[]
q = []
j=int(0)
def is_valid(a):
if a[0]>=0 and a[1]>=0 and a[3]>=0 and a[4]>=0:
if (a[0]==0 or a[0]>=a[1]) and (a[3]==0 or a[3]>=a[4]):
return 1
else:
return 0
else:
return 0
def is_goal(a,g)... |
31e4010124adcb18b700316adb0d20aaa3e5471c | 9a83773eb3e762a8227dd13c0b193a0d85a60fe1 | lsivar/s20 | /s20/asgi.py | Python | py | 383 | no_license | """
ASGI config for s20 project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_... |
2113952de22894b5ce28b0d9ac34337d156df335 | 843c99c4008bc19501231a339cd524ce5c3fde3a | Callus4815/tots | /user/migrations/0001_initial.py | Python | py | 963 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import user.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
... |
982d6810a0351162b496a82a3729e93e24388006 | ab1cb7331e1b652e5509e63ed6eb91bc3437df84 | theGreenJedi/Path | /Python Books/Mastering-Machine-Learning-scikit-learn/NumPy-Cookbook/NumPy Cookbook 2nd Edition_CodeBundle/Final Code/0945OS_10_Final Code/ch10code/corner_detection.py | Python | py | 451 | no_license | from sklearn.datasets import load_sample_images
import matplotlib.pyplot as plt
import numpy as np
from skimage.feature import corner_harris
from skimage.feature import corner_peaks
from skimage.color import rgb2gray
dataset = load_sample_images()
img = dataset.images[0]
gray_img = rgb2gray(img)
harris_coords = corner... |
0edf168e7a44e4efe5d427fe6efd4520977f4dfd | 162636704c8698e7ef168650b852e9e432be0960 | dmnhwjin/pymtest | /tester_gui.py | Python | py | 14,753 | permissive | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtCore import pyqtSlot, Qt
from PyQt5.QtWidgets import QApplication, QMainWindow, QListWidgetItem, \
QMessageBox
from PyQt5.uic import loadUiType
import time
import traceback
import serial
from scpi.errors import TimeoutError
import fwtp_core
import... |
f8d288c49f8b12210e40f23875d1ee92db7a5ea0 | f94f570685cbc3f6b2054638e34b01e958d589fc | snamper/zzpython | /zz91app/zz91app/func/myrc_function.py | Python | py | 39,444 | no_license | #-*- coding:utf-8 -*-
class zmyrc:
#----初始化ast数据库
def __init__(self):
self.dbc=dbc
def getviptype(self,company_id):
sql='select membership_code from company where id=%s'
result=self.dbc.fetchonedb(sql,[company_id])
if result:
return result[0]
#绑定的客户自... |
03fc1501c4e1c7329dbb958eb460b02748679cc3 | bdd67d09367e36b38363835cf7dc83d1eac8b456 | lihaochen910/PyQt5_Study | /ioo/GNSFile.py | Python | py | 1,681 | no_license | # -*- coding: utf-8 -*-
class GNS:
@staticmethod
def save(graphNodeViewScene):
nodes = []
from controls.GraphicsView.GraphNodeView import GraphNodeViewScene
from controls.GraphicsView.GraphNodeView import GraphNodeItem
pos = []
for gItem in graphNodeViewScene.items():
... |
26c69a90b28ea3561f0f57f43557f61dd1c68fd5 | 39a5cfe75f15720534837bff1180c024ce46ad31 | paulrsmithjnr/info3180-lab7 | /app/views.py | Python | py | 3,176 | no_license | """
Flask Documentation: http://flask.pocoo.org/docs/
Jinja2 Documentation: http://jinja.pocoo.org/2/documentation/
Werkzeug Documentation: http://werkzeug.pocoo.org/documentation/
This file creates your application.
"""
import os
from app import app
from flask import render_template, request, jsonify
from app.... |
3615c5032e75b518974e537ec1be61af556b89ee | 4604f4df3ecdeea9b1fd9e6ecb91b8914257afa0 | Inistlwq/tulipquant-code | /jqdata/macro_tables/MAC_POPULATION_YEAR.py | Python | py | 1,100 | no_license | # coding: utf-8
import datetime
from sqlalchemy import BigInteger, Column, DateTime, Integer, Numeric, SmallInteger, String, Table, Text, text
from sqlalchemy.dialects.mysql import TINYINT, TIMESTAMP, DECIMAL
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
metadata = Base.metadata
... |
2dbdb378e43d4b96f9a985a856887e69849667bf | 25f13b4eccdc69740c2f0fb51d564a459236bb8b | basepi/apm-agent-python | /elasticapm/conf/__init__.py | Python | py | 32,115 | permissive | # BSD 3-Clause License
#
# Copyright (c) 2012, the Sentry Team, see AUTHORS for more details
# Copyright (c) 2019, Elasticsearch BV
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Red... |
e953be05367cb73c9ef1640566991806845a0b87 | 38766db8a9a8f2c655fb09e7de0b482523cc5bbd | yaaminu/v8-cffi | /benchmarks.py | Python | py | 767 | permissive | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
if __name__ == "__main__":
import time
import gc
import timeit
import functools
from v8cffi.platform import platform
OPS_NUMBER = 110000
def do_all():
with platform as pm:
with pm.create_vm() as vm:
... |
4911ca9fb13a7d2b638aab40b6740cc45ece8405 | 389c9b7fe3e15e37dc8015697061f8f5f44ced01 | rgerkin/ephys-viz | /widgets/ElectrodeGeometry/ElectrodeGeometry.py | Python | py | 1,544 | permissive | from reactopya import Component
import numpy as np
from mountaintools import client as mt
import spikeextractors as se
class ElectrodeGeometry(Component):
def __init__(self):
super().__init__()
def javascript_state_changed(self, prev_state, state):
self.set_python_state(dict(status='running',... |
b5681ee772a87db2926775948b36483ee9abfca9 | d3a42b9984bed7ac0cfb1ceb1839a1586b8631c6 | ptarau/pypro | /natlog/conslist.py | Python | py | 837 | permissive | # immutable list emulation
from .unify import istuple
def genList(n):
return fromList(range(n))
def fromList(Xs):
Rs = ()
for X in reversed(Xs):
Rs = X, Rs
return Rs
def toGen(As):
while As != ():
A, As = As
yield A
def toList(As): return list(toGen(As))
def concat(... |
798d9d237d63c03b604acc8cf4079eba37a11b36 | 9f7e96128ffe30495882e0cfc5fc2bb1efd2f646 | alejandraavendano/final | /main.py | Python | py | 807 | no_license | ''' Pontificia Universidad Javeriana
Procesamiento de imagenes y visión
Alejandra Avendaño Cortina
Parcial Final 24/11/2
'''
import numpy as np
import cv2
import os
from matplotlib import pyplot as plt
from sklearn.mixture import GaussianMixture as... |
58acb735e3e1fedd671f64adf67c873994982ef0 | 2ad1a8ef2c6348a782596acd8d3b9d167e99574d | fabio1299/NEWS_Http | /cgi-bin/set_status_reeds.py | Python | py | 296 | no_license | #!/usr/bin/python
import cgi
import os
import sys
fs = cgi.FieldStorage()
print "Content-type: text/plain\n"
#for key in fs.keys():
# print "%s = %s" % (key, fs[key].value)
status = fs['status'].value
url = '/var/www/html/status_reeds.txt'
f = open(url,"w")
f.write(status)
f.close()
|
3f580e62cb3f819a6028d77bf6d348dac1b2997d | 141dcf94bc1736fb814d51bbb341ba4113bdc93d | Matlefkofsky/HW3 | /twitterhw3b.py | Python | py | 1,344 | no_license | # In this assignment you must do a Twitter search on any term
# of your choice.
# Deliverables:
# 1) Print each tweet
# 2) Print the average subjectivity of the results
# 3) Print the average polarity of the results
# Be prepared to change the search term during demo.
import tweepy
from textblob import TextBlob
cons... |
82898da37368f403b254fe5cec9b37a7108dad71 | 03acd0d857aa43316e15a42c480309bbdce555a3 | tsurf101/Finance | /nlkt_sample.py | Python | py | 2,262 | no_license | from nltk import sent_tokenize, word_tokenize, PunktSentenceTokenizer, pos_tag
from nltk.corpus import stopwords
#Something to keep in mind, Lemmatizing can be more powerful than stemming at times
"""POS tag list:
CC coordinating conjunction
CD cardinal digit
DT determiner
EX existential there (like: "ther... |
473599fc2dbcb299ebfb751e321268616e9715d8 | b8aa720083da272643cefc1552aa734e18c66018 | nokia-wroclaw/innovativeproject-health-care | /backend/common/permissions.py | Python | py | 839 | permissive | from functools import wraps
from flask import abort
from flask_jwt_extended import verify_jwt_in_request, get_jwt_identity
from backend.models import User
def roles_allowed(roles):
"""Takes a list of roles allowed to access decorated endpoint.
Aborts with 403 status if user with unauthorized role tries to a... |
2b755dd0d260579ec7833750e1e0609ff69312dd | 4bb663bfdc942091f382489c7ce25e3224be3293 | dumbM/portfolio | /blog/urls.py | Python | py | 778 | no_license | """portfolio URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/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-bas... |
8d26565d6ed57ca44ff7ca0b244ae94bf5e79d1f | 13885e8b44b8498e4db7cc4afc9319a24d39236b | HydrogenQAQ/LeetCode-Python | /#235.py | Python | py | 660 | no_license | # -*- coding: utf-8 -*-
"""
@author: Jinqf
@file: #235
@time: 2017/8/30 12:32
"""
class Solution(object):
def lowestCommonAncestor(self, root, p, q):
"""
:type root: TreeNode
:type p: TreeNode
:type q: TreeNode
:rtype: TreeNode
"""
if not root:
... |
3774474879ffb524782772695f7746f0934f8e8d | 5298328ff5eb8bce67a824f3119bb7cb78f07e29 | fullStackImperator/heroku_upload_test | /apps/app11.py | Python | py | 13,446 | no_license | # -*- coding: utf-8 -*-
import os
import pandas as pd
import numpy as np
import plotly.plotly as py
import plotly.graph_objs as go
from dash.dependencies import Input, Output, State, Event
import dash
import dash_html_components as html
import dash_core_components as dcc
import base64
import colorlover as cl
import da... |
72b924a40586cf5ed0333f6ebdb20ba6648720ee | 60991a8e7e0fef94b43c66209e950c09ab9287b9 | niteshsurtani/Personal_Assistant | /preprocessing_tools/extended_ner/food/ner_classifier/amounts.py | Python | py | 12,912 | no_license | from FILE_CONSTANTS import *
from operator import itemgetter
AMOUNT_EXIST_FILE = EXTENDER_NER_DIRECTORY + "food/ner_rules/amount/rules/amounts"
CURRENCY_LIST_FILE = EXTENDER_NER_DIRECTORY + "food/ner_rules/amount/rules/currency_list"
CURRENCY_DIRECTORY = EXTENDER_NER_DIRECTORY + "food/ner_rules/amount/rules/currency/"... |
0cae7e1678170d46306bb7166d3c210e6e1ca4b7 | d184397599702cc643f1c8a053a683b9f062c947 | iCodeIN/Project-Euler | /p079.py | Python | py | 2,242 | no_license | #!/usr/bin/env python2
# Project Euler: problem 79
# https://projecteuler.net/problem=79
# A common security method used for online banking is to ask the user for three
# random characters from a passcode. For example, if the passcode was 531278,
# they may ask for the 2nd, 3rd, and 5th characters; the expected repl... |
55839d87dab48105681617f1faaae687f036578c | be5cb094f744116f5326b3bdd0e195ababf6fc13 | LukeKuenneke/rosettaboy | /py/src/clock.py | Python | py | 1,033 | permissive | import pygame
import time
class Clock:
def __init__(self, profile: int, turbo: bool, fps: bool):
self.cycle = 0
self.frame = 0
self.profile = profile
self.turbo = turbo
self.fps = fps
self.pyclock = pygame.time.Clock()
self.last_report = time.time()
def... |
6bc37d25469691efe66e940a190f785622a7cc6d | f8f195f8c137c62dc5b1811d25bfaef151e70edd | ilshad/tackle | /setup.py | Python | py | 1,293 | no_license | import os
from setuptools import setup, find_packages
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(name='Tackle',
version='0.8.2',
description='Business oriented CMS',
long_description = read('README.rst'),
author='Ilshad Khabibullin',
... |
02d469d37031b1de4c3ba524103b74977742b263 | e2cd8928e0ce86bcd228ffd20bdc19514c1709f4 | Trust-genie/civil-lab | /Anti-Lychrels number.py | Python | py | 697 | no_license | """
An Anti-lychrels number is a number that forms a palindome thourg thr iterative process ....
"""
#since i ain't trying to solve for all primes am good
#first ill itroduce the ignition
n = 0
start = "True" # oh god i hate the while statement
def Primer(self, value):
while start == "True":
if... |
54ac40929e29828215e6fc7f5c11a587ef83288f | 1ec611abd1c044eff451c00662ae616db3d901de | SuperbWebDeveloper11/blog-api | /blog_with_viewsets/urls.py | Python | py | 558 | no_license | from django.urls import include, path
# from rest_framework.urlpatterns import format_suffix_patterns
from rest_framework.routers import DefaultRouter
from . import views
router = DefaultRouter()
router.register(r'', views.PostViewSet)
router.register(r'(?P<pk>[^/.]+)/comments', views.CommentViewSet)
router.register(r... |
46f27c107f600add91c92c6e1c9e2c3eaeb9c4ff | 061e2068cf28925c04249eecdbf1d63c76e7664f | ngraham20/maze-solver | /analize.py | Python | py | 403 | no_license | from generaterb import GenerateRB
from generatekruskal import GenerateKruskal
from generateprims import GeneratePrims
size = 25
count = 10
rb = GenerateRB(size)
rb.analyze(count)
p = GeneratePrims(size)
p.analyze(count)
k = GenerateKruskal(size)
k.analyze(count)
kruskal_maze = "mazes/Kruskal-25x25-0.01229s.png"
pr... |
edcdb795e49fc4d54e53b188e4e2dfafb8c34cd3 | 91ff5f7cc33482df22860dc54793217d053bacbc | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_199/736.py | Python | py | 1,128 | no_license | import sys
#cin = open('input.txt', 'r')
#cin = open('A-small-attempt0.in', 'r')
cin = open('A-large.in', 'r')
#cin = sys.stdin
cout = open('output.txt', 'w')
#cout = sys.stdout
current_str_iter = None
def next_token():
global current_str_iter
while True:
if current_str_iter is not None:
... |
ce1c3b9d921f701201952b6e544ed4938ca822e6 | 56b2316c68b5889105a0cee261ee05569ae970c2 | yuma-shin/eclsdk | /ecl/baremetal/v2/server.py | Python | py | 10,362 | permissive | # 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, software
# distributed under t... |
a087e7a7a745e7335398284d6066c4f1e1b5db90 | 6d0531ec00eae39d1c4912757381f6675dc054a7 | Allwin12/Django-chat-application-using-channels | /chat/consumers.py | Python | py | 1,308 | no_license | # chat/consumers.py
from channels.generic.websocket import AsyncWebsocketConsumer
import json
class ChatConsumer(AsyncWebsocketConsumer):
async def connect(self):
self.room_name = self.scope['url_route']['kwargs']['room_name']
self.room_group_name = 'chat_%s' % self.room_name
# Join room ... |
b403b3f6543619efae1d46eec2202c37fc4ebe3a | 336be0b47483d05f742b58fe35627990f72f7ebf | oltoco/googleapis-gen | /google/cloud/retail/v2beta/retail-v2beta-py/google/cloud/retail_v2beta/services/user_event_service/transports/grpc_asyncio.py | Python | py | 18,810 | permissive | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
7db64b7586fab500d7834d3abed4913b00d83930 | 9ad0a5892ae1618db24b4424a477a8c497f8d89d | hurricanelennane/google-ads-python | /google/ads/googleads/v6/services/services/feed_item_set_service/client.py | Python | py | 22,466 | permissive | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
8725bb7e98272d1a49a57e9795c860a4d6e7f76b | 698d6142529c12018d172213f3f116117512f7ce | agiannoul/Soccer-Data-Analysis | /SDA/predict.py | Python | py | 2,280 | no_license | import tensorflow as tf
import sys
# Just disables the warning, doesn't enable AVX/FMA
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
FILE_PREDICT=sys.argv[2]
PATH=sys.argv[1]
feature_names = ['HGfA','HGaA','HPts/Pld','Helo','AGfA','AGaA','APts/Pld','Aelo']
feature_columns = [tf.feature_column.numeric_c... |
9a8e2eecdd1ca66f32d8338ae575063aea7e4355 | 170dcea0ebd28a8fe550132b29814e37a2db1d45 | LoganElkins/Tethys-Precip-by-Location | /tethysapp/precip_by_location/model.py | Python | py | 3,311 | no_license | from sqlalchemy import create_engine
from scipy.spatial import KDTree
import pandas as pd
import os
import uuid
import pymysql
def getAllData(limit=None, distinct=False, testingHomePage=False, latitude=None, longitude=None, location_id=None):
username = ""
password = ""
sqlEngine = create_engine('mysql+pym... |
13f21041e8741a56bce289620db28d2d4949cb33 | ee01454fb1bbc1311fb40a94410527805acfc2fc | nickgeorge/textreader | /tools/index.py | Python | py | 1,586 | no_license | #!/usr/bin/python
if __name__ == "__main__" and __package__ is None:
from sys import path
from os.path import dirname as dir
path.append(dir(path[0]))
import sys
import argparse
import urllib2
import re
from common import flaf_db
from common import flaf_indexer
parser = argparse.ArgumentParser(
descr... |
ba5f518045e713f42d3fbf32a1bdd21bd94806cd | 20d5137fa2675f09fb589ec9c81454ef0813e085 | Stewie64/Backpropagation | /main.py | Python | py | 1,422 | no_license | import math
#Constants
class backpropagation:
def __init__(self):
self.netVal = 0
self.entries = [[0, 0], [1, 0], [0, 1], [1, 1]]
self.expectedValOut=[0,1,1,0]
self.expectedValIndex=0
self.weightsIn = [[0.1, 0.5], [-0.7, 0.3]]
self.weightsOut = [0.2, 0.4]
... |
2046b7b0130f981be60066c43f7347ed13af0eb7 | f742954aab633a24876557be8df9b7af61f58dc8 | juliadsilva/Python | /Numpy/numpyExercise/main.py | Python | py | 659 | no_license | # Remodelamento (Reshape) de Arrays
# Exercícios Propostos
# Importando NumPy
import numpy as np
print('Questao 1')
arr1 = np.linspace(0,1,12)
print(arr1)
print('Questao 2')
arr2 = np.arange(0,51,2)
arr3 = np.arange(100,50,-2)
arr4 = np.concatenate([arr2,arr3])
print(np.sort(arr4))
print('Questao 3')
print(np.flip(... |
b8e32667e0cd60a2f68371b830b88b14a3cf3086 | d03d18f5906ac0a7ab2504e9d7f107c5142b2dbd | AgileRE-2021/UseCaseSpecToBPMN | /UseCaseSpecToBPMN/app/migrations/0001_initial.py | Python | py | 807 | no_license | # Generated by Django 2.2.10 on 2021-05-22 18:10
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='project',
fields=[
('no', models.AutoField... |
d1e335837bcbe63fad0b20b2b15be86a60a99eb1 | 6bec7ee8df0ed49b273f11a0d9f7cb987ee08b77 | rtg0795/python_snippets | /check_string_palindrome.py | Python | py | 282 | no_license | # Source
# https://medium.com/better-programming/25-useful-python-snippets-to-help-in-your-day-to-day-work-d59c636ec1b
# check if a string is palindrome
# logic
def check_string_palindrome(string):
return string == string[::-1]
# test
print(check_string_palindrome('kayak'))
|
ca4a1b01b6e6508fe181e58988c0ed4147088c6a | a6a275a97a6bfd6ffe0fc2801a662add4ca6deb1 | korewayume/hue | /desktop/libs/libanalyze/src/libanalyze/models.py | Python | py | 8,091 | permissive | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.