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 |
|---|---|---|---|---|---|---|---|---|
65afe82e6ae7ed706c4b924d4acb796453f57291 | 1b9becd096eaab5c54389dbeba01f8cdce2a7560 | siBae/ADD_PRO | /httpserver.py | Python | py | 1,016 | no_license | #!/usr/bin/env python
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import SocketServer
class S(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
def do_GET(self):
... |
ac28bc81b36ed61423a1d138e455458d967375b5 | 89a2470a2c682b01651ed176f0ab2b861cabd7ae | yipenghe/cs224w-project | /code/fs_graphsage.py | Python | py | 7,942 | permissive | import torch
import torch_geometric
from torch_geometric.data import Data, Dataset, InMemoryDataset, NeighborSampler
from torch_geometric.nn import SAGEConv, GATConv
from torch import nn
import numpy as np
from data_preprocess_gnn import construct_dataset, get_labeled_index
from sklearn.model_selection import Stratifie... |
3dde4c6fea3561f372d532c965289a6ad02499cb | 7ca4a00c1bd5d592b0e156e8f3ffa03e8e994ac6 | Iswaria-A/ishu | /python/sample17.py | Python | py | 233 | no_license | import mysql.connector
mydb=mysql.connector.connect(
host="localhost",
user="root",
passwd="",
database="mydatabase")
mycursor=mydb.cursor()
mycursor.execute("SELECT * FROM customers")
myresult=mycursor.fetchone()
print(myresult) |
a8a45db56391c9cd8577cab51f8640969ba5b7f6 | 7f3c49b7c583aa38c234664ef4089240dafd8bb9 | Abdulbasitali3698/Winter2018-2019Stat-701MSCS | /Assignment 2/Assignment 2 Stat-701/Stat-701 Assignment-2 question3.py | Python | py | 2,947 | no_license | import numpy as np
import matplotlib.pyplot as plt
import math
import pandas as pd
def estimate_coefficient(x1 ,x2 , y):
# number of observations/points
n = np.size(x1)
print("No of Observation = {}".format(n))
k = 2
print("K = {}".format(k))
# mean of x and y vector
mean_x1 ,me... |
8684558dbaaac3c8438014dde9ddcfe6b24047aa | f935301a0815795db45991a245e252c7b5aff15c | valdergallo/study-django-pytest | /wars/tests/base.py | Python | py | 291 | permissive | # -*- coding: utf-8 -*-
import time
import unittest
class SlowTestCase(unittest.TestCase):
def setUp(self):
self._started_at = time.time()
def tearDown(self):
elapsed = time.time() - self._started_at
print('{} ({}s)'.format(self.id(), round(elapsed, 2)))
|
81d6196259f7befdb08dd1022f0d8863aae39bbf | f8a518990f2380fa9cb167059e65e2c40226025e | ShaAli/Work3_matrix | /matrix.py | Python | py | 1,297 | no_license | import math
def print_matrix( matrix ):
ret = ""
for r in range(len(matrix)):
for c in range(len(matrix[r])):
ret += str(matrix[r][c])
ret += "\t"
ret += "\n"
print ret
def ident( matrix ):
for r in range(len(matrix)):
for c in range(len(matrix[r])):
... |
51cd7e310e718bdc0394d8c056ec502fac0f1fea | 2965a81633330b9254228fcd3a7f29a43fb0ab68 | gujralsanyam22/data-science-portfolio | /trading_analysis_project_w_tkinter.py | Python | py | 11,471 | permissive | # libraries
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
window = tk.Tk()
window.geometry("1080x640")
window.wm_title("Trading")
pw = t... |
4ff2063f92c4d80679f90be74e624322777c98a3 | 0b0b11c949700437071f5959137782edeb079ea1 | ros-visualization/echo_tree | /src/echo_tree/echo_tree_server.py | Python | py | 18,484 | no_license | #!/usr/bin/env python
'''
Module holding three servers:
1. Web server serving a fixed html file containing JavaScript for starting an event stream to clients.
2. Server for anyone uploading a new JSON formatted EchoTree.
3. Server to which browser based clients subscribe as server-sent stream recipients.
... |
0a61da2dc2bb9ba068caa93f23e1f6abf004d2f8 | fc1d480246c6923422cde67849208744e7e27369 | zouxu92/flasky | /app/main/views.py | Python | py | 571 | no_license | from datetime import datetime
from flask import render_template, session, redirect, url_for
from . import main
from .forms import NameForm
from .. import db
from ..models import User
@main.route('/', methods=['GET', 'POST'])
def index():
form = NameForm()
if form.validate_on_submit():
# ...
retu... |
2d61247a1aaab7f90eaf1347abd6197603882511 | 4ca8e8756e8cf79646d9fb49f4b5ef1429b88412 | strogo/pyobjc | /pyobjc-framework-Contacts/PyObjCTest/test_cncontactstore.py | Python | py | 1,639 | permissive | from PyObjCTools.TestSupport import TestCase, min_os_level
import Contacts
class TestCNContactStore(TestCase):
def test_methods(self):
self.assertArgIsOut(
Contacts.CNContactStore.unifiedContactsMatchingPredicate_keysToFetch_error_,
2,
)
self.assertArgIsOut(
... |
02afffe86b6dcc921e0472338e231368ed9fd75d | 6af632dcea7524682949807a56a1cef2980f1655 | krizons/MailForm | /app/migrations/env.py | Python | py | 2,380 | no_license | import asyncio
from logging.config import fileConfig
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from sqlalchemy.ext.asyncio import AsyncEngine
from alembic import context
from conf import settings
from database import db_model
# this is the Alembic Config object, which provides
# access to ... |
a588de4843b5d689e70cf489052d57c84f52dc89 | 4dca5e2361b31f05a1d65185342cb53e3b4ca92b | darkless456/Python | /条件语句_if.py | Python | py | 319 | permissive | # 例1:if 基本用法
# coding = gb2312
flag = False
name = 'python'
if name == 'python': # 判断变量否为'python'
flag = True # 条件成立时设置标志为真
print('welcome boss') # 并输出欢迎信息
else:
print(name) # 条件不成立时输出变量名称
|
7cba4ed4edfb86ac3d5f79bc7be1843888cd12fc | 862819082d7077dc563233df10a3f27f7cca0598 | JakobPoncelet/assist_reg | /assist/scripts/test.py | Python | py | 9,140 | no_license | '''@file train_test.py
do training followed by testing
'''
import os
import sys
sys.path.append(os.getcwd())
import argparse
from ConfigParser import ConfigParser
import numpy as np
import glob
import shutil
import cPickle as pickle
from assist.tasks.structure import Structure
from assist.tasks import coder_factory
fr... |
6465d817ed8663e9eddb0c976a0da7c98fabed81 | ba63aaf8d38245a77deaea287e26072258cf7dca | optionalg/xolo | /main.py | Python | py | 10,655 | permissive | from flask import Flask,render_template,request,jsonify,request,make_response
import json,requests
import pypyodbc
from bs4 import BeautifulSoup as bs
app = Flask(__name__)
pypyodbc.connection_timeout = 8
current_engine = 'SQL Server' # default search engine
nodes_dict = {"nodes":[]}
links_dict = {"links":[]}
curren... |
a7b96db36c2979e4507da041f7bbc55f019547ab | 3599212bb0fb461b4d98dc6cbcd08d456576b5d4 | psrc/urbansim | /urbansim/models/correct_land_value.py | Python | py | 5,498 | no_license | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
from numpy import arange, logical_and, where
from opus_core.model import Model
class CorrectLandValue(Model):
""" Corrects land value to avoi... |
365aa8be7d565675c3ed5e6f85db8f29cd4532e3 | f7c1803f94342483c12543a5b6105edf3d69c6cf | achaf-soudqi/pytype | /pytype/pytd/typeshed.py | Python | py | 8,573 | permissive | """Utilities for parsing typeshed files."""
import os
from pytype import module_utils
from pytype import pytype_source_utils
from pytype import utils
from pytype.pyi import parser
from pytype.pytd.parse import builtins
def _get_module_names_in_path(lister, path):
names = set()
try:
contents = list(lister(pa... |
9a952b04a7ade2438b9b8f4c2b83b2191b7d76b2 | e9bf8ba648739b40c0f9fe29997692a281b828b9 | javacasm/micropythonTutorial | /codigo/moodLamp/BME280_test.py | Python | py | 815 | no_license | ## Medida de temperatura, humedad y presion ocn sensor BME280 ma
import machine # Usaremos los pines y el I2C
import Wemos # Convierte entre pines del ESP12 (que usa micropython) y los del Wemos
import BME280 # Importamos la clase BME280
def testBME280():
i2c = machine.I2C(sda = machine.Pin(Wemos.D2),scl = machi... |
10c30cda9e3a5ea148699c8fb359e5bb9e16b016 | 4113956807689a89c08adb6ccc5a024647d512fb | anhstudios/swganh | /data/scripts/templates/object/static/structure/general/shared_skeleton_ithorian_head.py | Python | py | 460 | permissive | #### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/structure/general/shared_skeleton_ithorian_head.iff"
result.attribute_t... |
1a64b93985f8969a8e7ddb56475ebe16a628d67e | c684e377b73f6aee65fcd783ed001d72872df21e | Alfonso-AML/data-analysis-pipeline | /v_data/test.py | Python | py | 4,688 | no_license | import pandas as pd
import numpy as np
import requests
from PIL import Image
from io import BytesIO
from fpdf import FPDF
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4, letter
from reportlab.lib.utils import ImageReader
"""
def getinfo():
films = pd.read_csv('./c_films.csv')
r_films = pd... |
f5b24c72def8e192f1da743b86edfa60fbf2b282 | bbe1e7ec74ee70a02bd6a16cf1592c6a7e07552b | AdityaVashishtha/WallOnTime | /imageLoader.py | Python | py | 365 | no_license | import urllib as URL
def loadImage(image_url,image_path):
print "downloading image started ....."
page = URL.urlopen(image_url)
image_info = page.info()
raw_data = page.read()
print "downloading image stop, writing to file ....."
image_file = open(image_path,"w")
image_file.write(raw_da... |
ef49ca545399dba2b0b4d2a6947fe46cbd7c2f83 | b716ef9c50b865e399d5481220111a845768f231 | ganeshghimire1986/watershed_workflow | /workflow/sources/manager_nrcs.py | Python | py | 18,089 | permissive | """National Resources Conservation Service Soil Survey database.
Author: Ethan Coon (coonet@ornl.gov)
Author: Pin Shuai (pin.shuai@pnnl.gov)
"""
import os, sys
import logging
import fiona
import requests
import numpy as np
import pandas
import collections
import shapely.wkt
import workflow.crs
import workflow.source... |
844a12b6b4b7e37b4e0b8cb58ed86ee7ad126143 | 5a7d30f9c564885e46de23f2ee27b2b55a8077a0 | David9203/SUP | /CodigoAplicativoPaisaje_setup/codigo_aplicativo/GUI_paisaje.py | Python | py | 21,637 | no_license | '''
Interfaz Gráfica y funciones para la extracción de descriptores de paisaje acústico.
al usar referenciar como:
C. Isaza, D. Duque, S. Buritica and P. Caicedo. “Automatic identification of Landscape Transformation using acoustic recordings classification”, Ecological Informatics, ISSN: 15749541. SUBMITTED 2019.
... |
cb273b062ea0da80cfe3ade4eb32f7e00e1864b5 | 8f7e485782738c32996c36b14b46ea6601169ed0 | ThatVoidUpdate/TinkeringGraphics | /Contract 5/Contract.py | Python | py | 1,319 | permissive | import colorsys
from PIL import Image
__author__ = "Matthew Shaw"
def normal_to_colour_blind(_normal_colour: (int, int, int), conversion_list: list) -> (int, int, int):
# Find where on the hue line the current colour is, by making them range from 0 to 1, and converting to HSV
normal_colour = [x / 255 for x i... |
9ba0e7ab6d9ff1dd316b7231cb41c6db809ab7da | 2129f20fffdd833c88a20e056ec89107ff31a503 | AceArthur/3D-Modeller | /aabb.py | Python | py | 3,071 | no_license | from OpenGL.GL import *
from primitive import *
import numpy
import math
EPSILON = 0.000001
class AABB(object):
def __init__(self, center, size):
self.center = numpy.array(center)
self.size = numpy.array(size)
def scale(self, scale):
self.size *= scale
def ray_hit(... |
8db0f412fd9be5f2b3b89dacf6647f7c2a0cb8b5 | 4e29d075cf1ae48116898eb9afd5863b2f0f44f5 | Rukosenpa/PowerCarSystem | /Accounts/migrations/0001_initial.py | Python | py | 2,868 | no_license | # Generated by Django 2.1.5 on 2019-04-01 06:06
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0009_alter_user_last_name_ma... |
12e0df8d29984cef0243d9ce2c1702c166b287bb | 7291deabe8589233e89222712bb1b70bade2fc24 | Esmidth/CS_GAN_MOD | /cs_gan/nets.py | Python | py | 3,621 | permissive | # Copyright 2019 DeepMind Technologies Limited and 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
45ab1a721c2399fbb8a97e5867ce73a3246504ef | d2a63277d953099082a2de52d2b449a175c1665c | changlizhi/swan | /client/task_sender/deal_sender.py | Python | py | 868 | permissive | import logging.config
from client.task_sender.service.deal import DealConfig, send_deals_to_miner
from common.config import read_config
logging.basicConfig(level=logging.DEBUG)
def send_deals(config_path, miner_id, metadata_csv_path=None, deal_list=None):
config = read_config(config_path)
from_wallet = conf... |
470dfc8e6807da1550dae66f82b93d2dfda3f25e | 27f1d67a289d6894f9e64b02dcda5a8519b875b5 | wisechengyi/pants | /src/python/pants/engine/addressable.py | Python | py | 15,633 | permissive | # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import inspect
from collections.abc import Mapping
from dataclasses import dataclass
from functools import update_wrapper
from typing import Any, Sequence, Set, Tuple, Type
from pants.bas... |
280c6a67e7122ce272c5914ed5a787b17b963482 | da39a3c1deb80db8d706fee867ae6e64f51898d0 | 0virax0/LaserProjector | /softPath_old.py | Python | py | 6,374 | no_license | # Input: eulerian networkX graph
# Output: an eulerian path with minimal angle maximized
# to do that i can consider every possible angle formed between edges on the graph and
# start to delete them starting from the smallest until an eulerian path exists, then
# i find a path (O(n^3)).
# To reach O(n^2*log(n)) com... |
21a471a68536975ccbfb1cf53629166c266be29f | b2ce68097bd8f7064aecfec1b7d77b4acc77cabd | joan1112/mypython | /doutuFile.py | Python | py | 2,715 | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import request
from bs4 import BeautifulSoup
import urllib.request
import os
import pai_parser
import re
import html.parser as h
import threading
import time
BASE_URL = "http://www.doutula.com/photo/list/?page="
PAGE_URL = []
FACE_URL = []
glock = threading.Lock()
for x ... |
eb08523eafe8c312e7d9e28e74a2ea9d6cae7ae1 | af2fcf7d37956917d983df7f64d0eb6a80267eba | xuchaoigo/LogPreprocess-clf-ana | /pattern_reg/common.py | Python | py | 7,152 | no_license | import os
import ConfigParser
import MySQLdb
import time
User=''
Pwd=''
Port=0
timeout=0
TypeSize=0
TypeList=[]
delimiter_arg=''
delimiter_behavior=''
delimiter_target=''
delimiter_count=''
delimiter_table=''
delimiter_feature=''
delimiter_item =''
delimiter_table_name=''
ThresholdList=[]
g_sample_log='Sample/Log'
... |
f5cf0ff8bea3567f8c0da26f895cdc1f38e056f4 | aa05246c9cd729407a7f400d94e76326f907662c | VOLTTRON/home-assistant | /homeassistant/components/remote/xiaomi_miio.py | Python | py | 8,054 | permissive | """
Support for the Xiaomi IR Remote (Chuangmi IR).
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/remote.xiaomi_miio/
"""
import asyncio
import logging
import time
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.rem... |
30284eb61154b1a56b0c2a68953cffa972bf283e | ca833a54fdf32fff035bf02334b37227b8fdec7c | thorwolpert/flask-jwt-oidc | /examples/flask_app/tests/conftest.py | Python | py | 646 | permissive | import pytest
from flask import Flask, current_app
from flask_jwt_oidc import AuthError, JwtManager
from examples.flask_app.app import create_app, jwt as _jwt
from examples.flask_app.config import TestConfig
@pytest.fixture(scope="session")
def app(request):
"""
Returns session-wide application.
"""
... |
25879c79376f27d47162276504c6608b112d761c | d8bd8a8643d9b5d1abd74fbd97bafb88c0e3a1f4 | ppatel826/zun | /zun/tests/unit/db/test_resource_provider.py | Python | py | 6,760 | 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
# d... |
cf006035ad52214fe788f43ba23d75ad16853f5f | 92a7129a8251073d3317c67429e6d0557d964cfa | whitespider2020102/every_study | /day5_longestCommonPrefix/longestCommonPrefix.py | Python | py | 1,071 | no_license | '''
!/usr/bin/env python38
@time : 2020/01/08
@Author : WhiteSpider
@File : longestCommonPrefix.py
@Version : 3.8
@Software: PyCharm
@Blog : https://github.com/whitespider2020102
说明:具体参考leetcode,最长公共前缀
题目:编写一个函数来查找字符串数组中的最长公共前缀,如果不存在公共前缀,返回空字符串 ""。。
具体思路:Python 特性,取每一个单词的同一位置的字母,看是否相同。
zip(*strs) 可理解为解压,返回... |
fc446e9378e05df28bff17c5db4ad731a3b341b4 | 3cd0e682c7a42f27b9e52dd89bda736e33d25fc0 | KelvinL98/CI_Simulator | /venv/Alans_Matlab/main.py | Python | py | 1,727 | no_license | import numpy as np
import soundfile as sf
import ACE
import MAP
from resample_tfm import resample_tfm
import sounddevice as sd
import matplotlib
import matplotlib.pyplot as plt
#define useful paramters
gain = 1 # input gain in dB, > 0
#get audio signal
[stim, fs] = sf.read("DORMAN_input.wav")
stim = np.multiply(np.pow... |
3185628c430954ec6e140d01f68b8af0024ed5a6 | 73737ccabfb224de8b67a1b90fd4067a93f3ea24 | doruksahin/KontroleDegerMi | /py-work/pipeline/zemberek/examples/morphology/add_dictionary_item.py | Python | py | 1,843 | permissive | # -*- coding: utf-8 -*-
## Zemberek: Adding Dictionary Item Example
# Java Code Example: https://github.com/ahmetaa/zemberek-nlp/blob/master/examples/src/main/java/zemberek/examples/morphology/AddNewDictionaryItem.java
import jpype as jp
# Relative path to Zemberek .jar
ZEMBEREK_PATH = '../../bin/zemberek-full.jar'... |
b32cdd8d3f6637688e87de928720dfca162332c4 | abec9ce3de659b69403dbd819498c121457449d5 | zarlo/flasktest | /app/main.py | Python | py | 544 | permissive | from flask import Flask, session
from flask_socketio import SocketIO
from .chatlog import *
from .mem import *
from .mongo import *
try:
monogo.Init()
chatlog.Init(monogo.AddChatLog, monogo.Getlast20)
print('mongo')
except Exception as e:
chatlog.Init(mem.AddChatLog, mem.Getlast20)
print('mem')
ch... |
5a2dc21050f97ce8c38ba9d7a5f6bb135d08701a | 5b90efd9d5e7cc770eb1da830aff018f73c38883 | fliem/niworkflows | /niworkflows/interfaces/cifti.py | Python | py | 16,448 | permissive | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Handling connectivity: combines FreeSurfer surfaces with subcortical volumes."""
from pathlib import Path
import json
import warnings
import nibabel as nb
from nibabel import cifti2 as ci
import numpy a... |
15cb41ab3bf7ead5ce6e87a9ca5af3cc12de9c92 | 8a88e50720a1e75377cd8d21dc93340ec3de879f | tmquan/QuadRand | /DQN.py | Python | py | 6,816 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: DQN.py
# Author: Yuxin Wu
import os
import argparse
import cv2
import numpy as np
import tensorflow as tf
import gym
from tensorpack import *
from common import *
from DQNModel import Model as DQNModel
from common import Evaluator, eval_model_multithread, play_n_e... |
4f5e46a4903047053e59593e8828302666a6fa19 | 886114f0dfbffd502f820d44b693410e16d105c8 | rigved-sanku/sentinelhub-py | /tests/test_time_utils.py | Python | py | 5,150 | permissive | """
Unit tests for time utility functions
"""
import datetime as dt
import pytest
import dateutil.tz
from sentinelhub import time_utils
TEST_DATE = dt.date(year=2015, month=4, day=12)
TEST_DATETIME = dt.datetime(year=2015, month=4, day=12, hour=12, minute=32, second=14)
TEST_DATETIME_TZ = dt.datetime(year=2015, mon... |
884d0c468ce2d6a8290e2d2cee8641c048f53479 | c60de666db186fa02e77210c48a2e79f977a161c | t-zhong/HSENet | /codes/model/transformer.py | Python | py | 2,946 | no_license | # reference: https://github.com/lucidrains/vit-pytorch/blob/main/vit_pytorch/vit.py
# : http://jalammar.github.io/illustrated-transformer/
import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# helpers
def p... |
dd9f4e68219d10db948c0c5e822e53ed94a981c2 | b512738c3db48db02fcbe90af81adf063a761556 | WilliamTun/Design-Patterns | /creational/singleton/singleton.py | Python | py | 1,026 | no_license | '''
Singletons
There are cases when we only want to initialise an object ONCE.
Eg. a Database or spark framework.
You want to be able to initialise this object lazily and ONLY when needed.
'''
def singleton(class_):
instances = {}
def get_instance(*args, **kwargs):
if class_ not in instances:
... |
d1112fe802c62e707398a0836134bb17db030e06 | 95ed70ad6825206a4e4df39053f442b8948fac24 | kyocen/Graduation-Design-VQA-based-on-deep-learning | /vqa-tools/PythonEvaluationTools/vqaEvalDemo.py | Python | py | 3,469 | no_license | # coding: utf-8
import sys
dataDir = '../../VQA'
sys.path.insert(0, '%s/PythonHelperTools/vqaTools' %(dataDir))
from vqa import VQA
from vqaEvaluation.vqaEval import VQAEval
import matplotlib.pyplot as plt
import skimage.io as io
import json
import random
import os
# set up file names and paths
taskType ='OpenEnde... |
bcecb617771f63115eaecd2b64933d8b1f78eb5a | 89a2312dafbee5127955c1bec1e436d2a588ff8d | aliyun/aliyun-openapi-python-sdk | /aliyun-python-sdk-cloudapi/aliyunsdkcloudapi/request/v20160714/DescribeLogConfigRequest.py | Python | py | 1,675 | permissive | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
d2f45fe46396a4141251adcae1becce845ff3c72 | bb2e1483669928eeb669b68130d457b839a14a6e | growlf/django-manifest | /manifest/accounts/settings.py | Python | py | 3,686 | permissive | # -*- coding: utf-8 -*-
# Accounts settings file.
#
# Please consult the docs for more information about each setting.
from django.conf import settings
gettext = lambda s: s
ACCOUNTS_REDIRECT_ON_LOGOUT = getattr(settings,
'ACCOUNTS_REDIRECT_ON_LOGOUT',
... |
13e2eafc9fa095cb9d7f212079a89754355d9969 | c81570848c56ee5a52f87de845cb0e600023e800 | wangaitao/ysxk_gpu | /build_so.py | Python | py | 3,634 | no_license | # coding:utf-8
import sys, os, shutil, time
from distutils.core import setup
from Cython.Build import cythonize
starttime = time.time()
currdir = os.path.abspath('.')
parentpath = sys.argv[1] if len(sys.argv) > 1 else ""
setupfile = os.path.join(os.path.abspath('.'), __file__)
build_dir = "build" # 项目加密后位置
build_tmp_... |
d498a34827f7b76135e27ab29d8edb0e43ccc045 | 3e0dc1ee4e1a2e0cdcfdcbc0b3c08c3ced23514d | PluciennikEdyta/python-scripts | /Permissions/permission.py | Python | py | 4,134 | no_license | #!/usr/bin/python
import os
import subprocess
import xlsxwriter
class CommandNotArtifactableException(RuntimeError):
pass
class NotEnoughCommandParams(RuntimeError):
pass
class BaseCommand(object):
should_gather_artifacts = False
should_return_value = False
artifacts_path = ''
command = ... |
ca01dd75f9ca738c770c2e092c1abb6de4be27f1 | c2bfa47da76e407116876e5295fbb2ad83f27521 | kutyasuli/kartyagenerator | /qr-generator.py | Python | py | 829 | no_license | #!/usr/bin/env python3
import os
from PIL import Image, ImageDraw, ImageFont
from PyQRNative import *
from verhoeff import *
codesDir = 'codes'
if not os.path.isdir(codesDir):
os.makedirs(codesDir)
codeFont = ImageFont.truetype("Ubuntu-B.ttf", 80)
bkImg = Image.open("kutyasuli-tagkartya.png")
# retrieving QR c... |
95de59df78c4b88150e75e3c1321e3054160371c | 68fc387d7aa56087ddb46528d5e73f8adde9f56c | SrinivasaBharath/ceph-1 | /qa/tasks/cephfs/fuse_mount.py | Python | py | 16,255 | permissive | from io import StringIO
import json
import time
import logging
import six
from textwrap import dedent
from teuthology import misc
from teuthology.contextutil import MaxWhileTries
from teuthology.orchestra import run
from teuthology.orchestra.run import CommandFailedError
from tasks.cephfs.mount import CephFSMount
l... |
8d5d517f3d11aa7379bbe26b2729b5181b111fda | d8b75c68b49d415100703ef05e6ff4fd1df982c5 | prasanmouli/warehouse | /tests/unit/cli/search/test_reindex.py | Python | py | 9,570 | 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 the Li... |
f8f84f2f27d5e453173433f027af3514fefbe6f9 | ff05ea1baa6620c0a9e27f39ceb9f5d462f532f1 | sorata2894/rlcard3 | /tests/unittest/envs/test_blackjack_env.py | Python | py | 1,946 | permissive | import unittest
import numpy as np
import rlcard3
from rlcard3.agents.random_agent import RandomAgent
class TestBlackjackEnv(unittest.TestCase):
def test_init_and_extract_state(self):
env = rlcard3.make('blackjack')
state, _ = env.init_game()
for score in state['obs']:
self.a... |
e15fa43afbb02ee26c129fb28e91e673764910d1 | 5b939438f62a145ed3cdd49cb7456c892d886247 | Lyncoln/Estudos-de-Web-Scrapping-com-python | /Scripts/CCETUnirio.py | Python | py | 2,266 | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 22 09:37:45 2019
@author: tpc 02
"""
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
import time
import os
def checarExiste(xpath):
try:
driver.find_element_by_xpath(xpath)
except NoSuchEleme... |
b6bdfdc6db85fcdbdce3178e9bf58a6699946d93 | 60644e59a3e60c07fbc4c0ff8016d433d213a98b | lzbernardo/VantageSportsLoL | /lolocr/tools/generateCorrectionGraphs.py | Python | py | 1,190 | permissive | import sys, os
# This generates a bunch of csv files of before and after, that show the impact of the
# correction scripts.
# The input should be the uncorrected raw json that's output from generate_states.py
if __name__ == '__main__':
videoJson = sys.argv[1]
os.system("python correction/correct_states.py -i ... |
f8ed089b5ba17e610d9f64fe0e2a1b3334ef8803 | ee8f7da8f3af3584fa5df0cfb03b42a53f5c7e64 | HymEric/LeetCode | /python/539.py | Python | py | 1,434 | permissive | # -*- coding: utf-8 -*-
# @Time : 2019/10/15 0015 18:15
# @Author : Erichym
# @Email : 951523291@qq.com
# @File : 539.py
# @Software: PyCharm
class Solution:
def findMinDifference(self, timePoints:list) -> int:
timeMin=[]
for time_ in timePoints:
min_ = int(time_[0:2]) * 60 + i... |
17c50aac22bc0c11fcdf7dd64f540cb3cbac94f2 | ae7b8969ab411f31bb2db53438efa61c88943412 | lriccombene/sistemaCooperativas | /Cooperativas/w_form_cooperativa_alta.py | Python | py | 6,209 | no_license | import sys
from PyQt5.QtWidgets import QApplication,QDialog,QMessageBox,QTableWidgetItem,QWidget
from PyQt5 import uic
from form_cooperativa_alta import Ui_form_cooperativa_alta
from E_cooperativa import E_cooperativa
from E_cooperativa_address import E_cooperativa_address
from PyQt5.QtCore import pyqtRemoveInputHook
... |
389ab166bb6a578acf94a6ef38c75e115dc451c1 | abfdab3295e84e23af482f2695b54ad009d9a45a | artsemm/artsemblog | /blog/views.py | Python | py | 1,562 | no_license | import urllib.parse as parse
from django.views.generic import TemplateView
from django.shortcuts import render
from blog.models import Post
from taggit.models import Tag
# Create your views here.
class PostListView(TemplateView):
template_name = 'post_list.html'
def get(self, request, tag_slug=None):
... |
57d331ed1ddaed15214126b323ff99c5d2bbda65 | bafdf84ae125ca890868d713c28112ac7d367474 | timLarocque/mlhHackAE | /admin-ui/cityecho/cityecho/urls.py | Python | py | 1,005 | no_license | """cityecho URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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')
Class-b... |
56e28b209a24d27ea60c4cf8fb46df75096c3b56 | 25dc33b095b18dd6081f2455098fb1da7280eb9d | mayera8/Auto-Mouse-Mover | /automousemover.py | Python | py | 618 | no_license | #script moves mouse to each of the 4 corners of the screen, taking 2 seconds to complete movement. Pause for 5 seconds
import pyautogui
pyautogui.FAILSAFE = True
pyautogui.PAUSE = 2
screenWidth, screenHeight = pyautogui.size()
def loopOfMyCount(count):
while count >= 0:
pyautogui.moveRel(None, 100, dura... |
3f20ebd6999a86bc7a94968a1c109e2539603ac7 | 9118ff3030353935f28b8cc94512b2be54963ff3 | srikanthpragada/PYTHON_27_AUG_2020 | /demo/libdemo/list_valid_mobiles.py | Python | py | 353 | no_license | import re
# Print valid mobile numbers in sorted order
def ismobile(v):
return len(v) == 10
f = open("phones.txt", "rt")
mobiles = []
for line in f.readlines():
# parts = re.split(r"\D+", line)
parts = re.findall(r"\d+", line)
mobiles.extend(filter(ismobile, parts))
for number in sorted(set(mobiles... |
8f09969688f8162afd04e2138386f71e640d28da | df66c2efca91f8f983968430d1db905fd77fae43 | ojasmehta3007/custom-addons | /school_management/report/report_function.py | Python | py | 2,341 | no_license |
import pytz
from openerp.osv import osv
from openerp.report import report_sxw
from datetime import datetime
class TrainingReport(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(TrainingReport, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
... |
eeece9a9a9a9aa388b89b7f2ed958cec49ac9eae | 2a1dbe9d8f9a66d567ce1622c01fd2abcc02255b | IIC2233-2016-1/syllabus | /Ayudantias/AY13 - Serialización/ejemplo1_pickle.py | Python | py | 1,479 | no_license | import pickle
from datetime import datetime
class Perro:
def __init__(self, nombre, dob, peso, color, raza, es_hembra):
self.nombre = nombre
self.dob = dob
self.peso = peso
self.color = color
self.raza = raza
self.es_hembra = es_hembra
def __getstate__(self):
... |
98ebd3a5a00caf599dbb0599d5ad0f141e549b9e | b5add964a0170f28fd30d5bf31e80f3718d737de | guozi65/a10-neutron-lbaas | /a10_neutron_lbaas/etc/defaults.py | Python | py | 2,116 | 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
# d... |
543b6707af5ed9ba98f6ad2929637cfd5b176513 | 10bef1f2b06e7f5230b0380b818d708a0db54d49 | IsHYuhi/FujiFilm_Brains_Solution | /Q2_classification_inference.py | Python | py | 4,345 | no_license | import argparse
import os
from typing import List, Union
import numpy as np
import pandas as pd
import timm
import torch
import torch.nn as nn
from libs.config import Config, get_config
from libs.data_loader import ImageDataset, ImageTransform, make_datapath_list
from libs.models import fix_model_state_dict, get_fcn
... |
cdc43507ed60d8e6dc81d6293bbe887ce671db0d | 15f8753e1b48ef8db836b1a9c2ae4b7d6a8ae146 | Aki1608/Pushup_counter_OpenCV | /Pushup_counter.py | Python | py | 2,446 | no_license | import cv2
import numpy as np
import mediapipe as mp
import time
import math
# I have used mediapipe module for this project.
# To get more informtion of mediapipe visit "https://google.github.io/mediapipe/"
mpDraw = mp.solutions.drawing_utils
mpPose = mp.solutions.pose
pose = mpPose.Pose()
#pTime = 0
count = -1
po... |
f8563d2ed08f7858b959654457d76077739b1b42 | 3411543fa0628af80ea925753fa35feb6e6bf0a6 | stephenbiit/training | /erp/crm/models.py | Python | py | 360 | no_license | from django.db import models
# Create your models here.
class Customer(models.Model):
name = models.CharField(max_length=200)
mobile = models.CharField(max_length=10)
email = models.CharField(max_length=50)
class Meta:
db_table = 'tbl_customer'
app_label = 'crm'
def __... |
56ad94f5158e78f9fb247cb15b3d0b6b696d9fda | db72f4e6c6e94bac72f99dd6c95664f66502a119 | jaredmales/MagAO | /PyModules/AdOpt/autogain.py | Python | py | 12,855 | no_license | #@File: gain_optimize.py
#
# Sweep the loop gain and record slopes in the meantime
# First and last gain value, and step, and how many times to repeat the ramp-up
from AdOpt import fits_lib, cfg, setupDevices, thAOApp, calib, AOVar
from AdOpt.wrappers import idl, diagbuf
from AdOpt.AOExcept import *
from numpy import... |
eada4e16d53236a034e73d1148d0454222d5a4bc | 1a542566d35d6a5a8dcd9418db6c5d2456d3dccf | adhimoni/Personal-Network-Packet-Sniffer | /type_of_service.py | Python | py | 1,215 | permissive | #!/usr/bin/python
#Extraction of Type of Service, i.e. TOS generally 8-bits
def getType_Of_Service(packet_data):
precedence = {0: "Routine", 1: "Priority", 2: "Immediate", 3: "Flash", 4: "Flash override", 5: "CRITIC/ECP", 6: "Internetwork control", 7: "Network control"}
delay = {0: "Normal delay", 1: "Low delay"}... |
e22bfd94a96d632607b5a8730ebd50f63bba8998 | ff15cf93e4b7f766f79deea6e0fccc5f654fba99 | DonVitoMarco/algorytmy-uczenia-maszynowego | /Zadanie04/main.py | Python | py | 5,693 | no_license | import pandas as pd
from sklearn.model_selection import GridSearchCV
from sklearn.neighbors import KNeighborsClassifier
from sklearn.preprocessing import StandardScaler, LabelEncoder
train_dataset = pd.read_csv("data/train.csv")
test_dataset = pd.read_csv("data/test.csv")
dataset = train_dataset.append(test_dataset, s... |
dfb111d1f83b3ce71253a87356ee4ec47a699356 | 4c8f45c9f7beb45e2dc675023b3884e3f2c2f4f7 | Johannes-Sahlmann/pystrometry | /pystrometry/utils/archives.py | Python | py | 8,368 | permissive | """Some query helpers.
Authors
-------
Johannes Sahlmann
"""
import logging
import os
from astropy.table import Table
import astropy.units as u
from astroquery.gaia import Gaia, TapPlus
from astropy.time import Time
import pandas as pd
def get_gaiadr_data(analysis_dataset_name, data_dir, source_id_array=None, g... |
7b3448b890526a8bd7f4df1cdfe2c49e21846bfb | 1752a996c6875ff7abc33b8a1c21a83177ae63b2 | gdqyhezhiyong/airbyte | /airbyte-integrations/bases/base-normalization/normalization/transform_catalog/reserved_keywords.py | Python | py | 19,389 | permissive | """
MIT License
Copyright (c) 2020 Airbyte
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distr... |
fdeae77c4985209cf060025d3a936ed6fd06c1fb | 504aab1886280e804cc1684e29ddb3a039de47a8 | kuri65536/python-for-android | /python-modules/zope/zope/interface/tests/ifoo.py | Python | py | 903 | permissive | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... |
b3075e2cb267403e130fd1af2b37a170b7810375 | 8117918c5bdfcef50fe46ba7a672b9fb833e7d1b | databill86/HyperFoods | /venv/lib/python3.6/site-packages/nltk/corpus/reader/pros_cons.py | Python | py | 5,069 | permissive | # Natural Language Toolkit: Pros and Cons Corpus Reader
#
# Copyright (C) 2001-2019 NLTK Project
# Author: Pierpaolo Pantone <24alsecondo@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
CorpusReader for the Pros and Cons dataset.
- Pros and Cons dataset information -
Contact: Bing... |
d58e427fff7aa1cc3c1211ce522c9cf59c713b58 | 3b0a283e3c227fd44d40fdfbf78e39105beff18b | BerilBBJ/scraperwiki-scraper-vault | /Users/B/bassdread/pdf_extractor.py | Python | py | 2,134 | no_license | import scraperwiki, lxml.html, feedparser
import urllib
from pyPdf import PdfFileReader
def fetch_pdf(url):
"""Fetch the pdf and extract the text."""
filename, http = urllib.urlretrieve(url)
print url
input1 = PdfFileReader(file(filename, "rb"))
p = input1.getPage(0)
print p
#retur... |
b617d5ef4e7bece88840785f43729236de9bc318 | 9f80e3eb91d05828f091a17caa3b108c27c0edfd | Dolphin4mi/gauge-equivariant-mesh-cnn | /gem_cnn/tests/transform/test_simple_geometry.py | Python | py | 381 | no_license | # Copyright (c) 2021 Qualcomm Technologies, Inc.
# All rights reserved.
import torch
from gem_cnn.transform.simple_geometry import find_first_neighbour
def test_find_first_neighbour():
edge_index = torch.tensor(
[
[2, 0, 1, 0, 1, 1, 2],
[0, 5, 3, 1, 1, 5, 7],
]
)
a... |
d0dd79192d3f492f5fd40f2d18e737bdee4eda90 | 677c149a93bc34dd9a6610321479d6296cfe03da | gerardo-valq/Python_done_works | /Firsttermproject.py | Python | py | 12,666 | no_license |
# February 13, 2016
# Angeles Rodriguez Hernandez A01173339
# Gerardo Arturo Valderrama Quiroz A01374994
# Omar Rodrigo Orendain Romero A01374568
# Alfredo Alarcon Valencia A01375414
# Group 4
# Project
# START
# Import Turtle Library
from turtle import *
#Assigning a speed
speed(10)
# Color Setti... |
6c444e403681d6869e79237dd44b84dac406b809 | a491285d921d88727c4d2cf9d7ab3baeb4f91f6b | garytan0722/scrapy_hiapk_for_windows | /scrapy_hiapk/spiders/spiders.py | Python | py | 1,216 | no_license | # -*- coding: utf-8 -*-
import scrapy
from scrapy_hiapk.items import ScrapyHiapkItem
class apkspider(scrapy.Spider):
def __init__(self, category='',start=None, end=None, *args, **kwargs):
super(apkspider, self).__init__(*args, **kwargs)
#self.start_urls = ['http://www.example.com/categories/%s' % c... |
f796cc89ef48e566ae5ea591ee9b6bbc728fdf4c | edd9d00acde592d357c015d3a3ca0dfeffabae31 | aberalec/Virtual-Salon | /SEAN/data/custom_dataset.py | Python | py | 2,209 | no_license | """
Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
from SEAN.data.pix2pix_dataset import Pix2pixDataset
from SEAN.data.image_folder import make_dataset
class CustomDataset(Pix2pixDataset):
... |
79d56024a6aaa29d94dfcb86b5f0c00261c35992 | bdbe7f2b99c666e1070229cbb80cead7a97268fe | Python3pkg/Arpeggio | /tests/unit/test_parser_resilience.py | Python | py | 328 | permissive | # coding=utf-8
from arpeggio import ParserPython, EOF
import pytest
def test_parser_resilience():
"""Tests that arpeggio parsers recover successfully from failure."""
parser = ParserPython(('findme', EOF))
with pytest.raises(TypeError):
parser.parse(map)
assert parser.parse(' findme ') is n... |
2ace52941886a71a930367c2c8aacc090469d37e | 186e43c388f02015fa3908108317484fb90ce92f | nikoGao/Leetcode | /63. Unique Paths II/AC_Answer.py | Python | py | 1,024 | no_license | # Connected with 62, only need to judge whether it is block, if is, then current path is 0, nothing to add.
class Solution(object):
def uniquePathsWithObstacles(self, obstacleGrid):
"""
:type obstacleGrid: List[List[int]]
:rtype: int
"""
m = len(obstacleGrid)
... |
db2881f1da69e5dd9525326b41cc84b920c5a76e | 8826f3b697789197c75b5918b484e4348f86ac98 | sahaanac/BIOL5153 | /assn04/write_pinnacle_slurm.py | Python | py | 1,483 | no_license | #! /usr/bin/env python3
# This script generates a SLURM script for the AHPCC Pinnacle cluster
jobname = "chandran_pinnacle_python_test"
queue = "comp01"
node = 1
processor = 32
wall = 5 # this is in hours
# This section prints the header/required info for the SLURM script
print('#SBATCH - J' + " " + jobname) # jobnam... |
dfef31b9ba1b4c123a8f1b3901325fca7955c956 | fb02cbce00a7d07aadfe984b831bfb260e64b5e4 | jdschae/TeleMeWhere | /API/extensions.py | Python | py | 388 | no_license | import pymysql
import pymysql.cursors
import config
url_secret = ''
def connect_to_database():
options = {
'host': config.env['host'],
'user': config.env['user'],
'passwd': config.env['password'],
'db': config.env['db'],
'cursorclass' : pymysql.cursors.DictCursor
}
db = pymysql.connect(**opt... |
6ada74e959b5312329836941ef04f689ccbebd51 | 811b4096746fb654c2a4c527f6db82241eefb93c | hilderjares/computer-vision | /aula03-transformacoes-geometricas.py | Python | py | 1,403 | no_license | import sys
import cv2
import numpy as np
import matplotlib.pyplot as plt
#abre imagen
filename = sys.argv[1]
im = cv2.imread(filename)
#converte pra RGB
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
#dimensoes
width = im.shape[1]
height = im.shape[0]
#matrizes de transformacao
#rotation 45 graus
#x_center = width/2
#... |
2dd295bca330258c7cc8c636ebd4ecab9fb7d0e3 | 71f02b45a9da5b200b744e22605a2b70029f5ed5 | simonkoener66/tempsurge-django-project | /agencies/migrations/0041_auto__del_check.py | Python | py | 60,121 | no_license | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Check'
db.delete_table(u'agencies_check')
def bac... |
5a417935f62f213a51fcd6bf5887755e49fb4088 | c431d6f903eba3c29fd1300b9c42c59962305106 | Pengfight/first_test1 | /full_ordered_generation/permutation_exp2.py | Python | py | 10,321 | no_license | import operator
import math
def arr_traversing(arr):
for i in arr:
print(i, end=' ')
print()
def dictionary_sort(arr, k):
"""
eg: arr = [8,3,9,6,4,7,5,2,1]
"""
# covert to the number of mediators
temp_arr = list(range(len(arr)))
for i in range(len(arr)):
flag = 0
... |
1ac01691828f579ce7afdd3dc2788857331c672e | c293b6a5bf8eef4c38363a31b88bcbe84ec69759 | kchanhee/pythonpractice | /insertSortLinkedList.py | Python | py | 1,473 | no_license | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @param A : head node of linked list
# @return the head node in the linked list
def insertionSortList(self, A):
if A is None or A.next is None:
... |
24e0fcb3f661879d663b1c5ce919ac53ae6dd4ec | 3507233b5d702d42a7af26b9ecb1dc0e784d2fb0 | OpenJarbas/little_questions | /little_questions/classifiers/sgd/__init__.py | Python | py | 6,853 | permissive | from little_questions.settings import DATA_PATH
from little_questions.classifiers import QuestionClassifier, \
MainQuestionClassifier, SentenceClassifier, best_pipeline
from text_classifikation.classifiers.sgd import SGDTextClassifier
from os.path import join
class SGDQuestionClassifier(QuestionClassifier, SGDTex... |
82cc55bf1a24c85ec8ea00469aabff12a2ceb1b7 | a7933de8fd8a73240641f98ff9407dbdf050e209 | bkhoward/aciDOM | /venv/Lib/site-packages/cobra/modelimpl/fv/pathep.py | Python | py | 6,059 | no_license | # coding=UTF-8
# **********************************************************************
# Copyright (c) 2013-2020 Cisco Systems, Inc. All rights reserved
# written by zen warriors, do not modify!
# **********************************************************************
from cobra.mit.meta import ClassMeta
from cobra.m... |
1ead9a7610ec3f2379121994e7b59215bfdaab7b | 0babc2af2fbbc0ba151c40c6d47e2efe1ddd8e8c | allek6496/NEAT | /individual.py | Python | py | 3,959 | no_license | from math import e
from random import uniform, choice
import numpy as np
'''
The static structure has the following inputs and outputs
Inputs:
Your balls
Enemy's balls
Your ducks
Enemy's ducks
Your points
Enemy's points
Your previous move
Enemy previous move
Enemy second previous move
Enemy third previous mo... |
1a2c284b62eddefc9d3528fc6f3fdbeaec0231e8 | b2fd54018cc85e82faab1ed75c377b376b32aa26 | LeSphax/RL_Experiments | /Matchmaking/wrappers/auto_reset_env.py | Python | py | 599 | no_license | import gym
from gym.core import Wrapper
class AutoResetEnv(Wrapper):
def __init__(self, env, max_steps=None):
Wrapper.__init__(self, env=env)
self.steps = 0
self.max_steps = max_steps
def step(self, action):
obs, rew, done, info = self.env.step(action)
self... |
91d5ec4b3eb427e025623d5a2544db495e717f93 | eb8fe40623ce65ae51b77d072f6ca241b798b3b2 | teodorov/F3 | /benchmarks/ltl_timed_automata/train/f3/train_gate_0009.py | Python | py | 29,685 | permissive | from collections import Iterable
from itertools import chain
from math import log, ceil
from mathsat import msat_term, msat_env
from mathsat import msat_make_constant, msat_declare_function
from mathsat import msat_get_rational_type, msat_get_integer_type, \
msat_get_bool_type
from mathsat import msat_make_and, ms... |
d2c0ddc125a24af718a540ba30a77097d3bb6d43 | 1155ef735fd669e5def06ab2268766da301e509b | calebxcaleb/Star-Wars-Shooter | /Enemy.py | Python | py | 2,179 | no_license | import Paint
import Values
import random
import pygame
class Enemy:
pygame.init()
x = 0
y = 0
r = 12
shoot_count = 0
shoot_count_max = 1125
shoot_count_max_min = 750
shoot_count_max_max = 1500
can_shoot = False
alive = True
enemy_img = ''
bullet_path... |
f9d74b4642e4d8061ec4c9551072d19b9ad536ab | 896b41f29dd229ae3c3cbca4d3bea2357c34b85b | bjornlalin/advent-of-code-2019 | /python/day16.py | Python | py | 1,390 | no_license | import sys
import re
import numpy as nd
base_phases = [1, 0, -1, 0]
def to_i_a(line):
i_a = []
for c in line:
i_a.append(int(c))
return i_a
def filter(i_a, index):
# Repeated pattern (subtract the number of leading 0's for the offset)
pattern = nd.repeat(base_phases, index+1)[0:len(i... |
82f9b479f9c49fa935cba7a2447829d534757abb | 8e3fa18fd7ff585ffb1dc75ce27f899fafeaa221 | leilalu/algorithm | /剑指offer/第一遍/array/57-2.和为s的连续正数序列.py | Python | py | 1,939 | no_license | """
题目描述
小明很喜欢数学,有一天他在做数学作业时,要求计算出9~16的和,他马上就写出了正确答案是100。
但是他并不满足于此,他在想究竟有多少种连续的正数序列的和为100(至少包括两个数)。
没多久,他就得到另一组连续正数和为100的序列:18,19,20,21,22。现在把问题交给你,你能不能也很快的找出所有和为S的连续正数序列? Good Luck!
输出描述:
输出所有和为S的连续正数序列。序列内按照从小至大的顺序,序列间按照开始数字从小到大的顺序
输入一个正数s,打印出所有和为s的连续正数序列(至少含有两个数)
例如,输入15,由于1+2+3+4+5 = 4+5+6 = 7+8 = 15
所以打印出3个连续序... |
b7aa640e0539b1b8ddd8263dbce67defa9e05b4a | 398f9d4cf2e24be7d2015c6712cbe4247467f753 | chaddattilio/head-first-python | /panic2.py | Python | py | 217 | no_license |
phrase = "Don't panic!"
plist = list(phrase)
print(phrase)
print(plist)
new_phrase = ''.join(plist[1:3])
new_phrase = new_phrase + ''.join([plist[5], plist[4], plist[7], plist[6]])
print(plist)
print(new_phrase)
|
1c23de0d0be66d12d567d91c642659fa15cb62dc | 8fe9a0df18c2b3c21e9f621c6781c071538dbf90 | chepe4pi/ethereum_scanner | /app_timeline/tests.py | Python | py | 5,645 | no_license | import datetime
import pytz
from constance import config
from django.urls import reverse
from mongoengine.context_managers import switch_db
from rest_framework import status
from rest_framework.test import APITestCase
from app_core.tests.mixins import AuthorizeForTestsMixin, CreateMongoTxsAndBlocksMixin
from app_foll... |
4fabf4b4d3245a9f597e552f5372f888c7ab3175 | d270be6778d448b4e8bbd494b81712e7ab6b50e2 | jianhuaixie/elephas | /elephas/spark_model.py | Python | py | 12,047 | permissive | from __future__ import absolute_import
from __future__ import print_function
import numpy as np
from itertools import tee
import socket
from multiprocessing import Process
import six.moves.cPickle as pickle
from six.moves import range
from flask import Flask, request
try:
import urllib.request as urllib2
except Im... |
1bced556c02dba7010deeabb7916f2d6e8bf9046 | d7efc297d112e8582713b859241490a53bac14e7 | tomasolodun/kolokvium | /40.py | Python | py | 703 | no_license | '''Обчислити суму парних елементів одновимірного масиву до першого зустрінутого нульового елемента. '''
import random
array = [random.randint(0, 10) for i in range(30)]
print('Даний масив:\n', array)
array_filtered = list(filter(lambda i: i % 2 == 0, array))
print('Відфільтрований масив:\n', array_filtered)
sum... |
b2b491a1955f91aed1e29c6036685bc2e84c2d3c | b7602991c01727abce08592bd02005ef77a90f0f | DariaKharitonova/python-project-lvl2 | /tests/helpers.py | Python | py | 244 | no_license | import yaml
import json
def read_json(file_path):
with open(file_path, 'r') as file:
return json.load(file)
def read_yaml(file_path):
with open(file_path, 'r') as file:
return yaml.load(file, Loader=yaml.FullLoader)
|
0f187baaa071b5cd7adc62d5585c166cb3d1c759 | 3fa573e28b93fa539131e433e1f2980644e5dbd9 | lips-k/brasil.gov.tiles | /src/brasil/gov/tiles/tiles/potd.py | Python | py | 2,485 | no_license | # -*- coding: utf-8 -*-
from brasil.gov.tiles import _
from collective.cover.tiles.base import IPersistentCoverTile
from collective.cover.tiles.base import PersistentCoverTile
from plone import api
from plone.namedfile import field
from plone.tiles.interfaces import ITileDataManager
from Products.CMFPlone.utils import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.