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 |
|---|---|---|---|---|---|---|---|---|
53b97706054d51f6c4613bb456b4de9340b60da8 | 8c8e5524c673e2890c0293f87dbbd79b5fd1c9d4 | mattstermh93/Law-Mockup-Site | /migrations/versions/68f35de88272_users_table.py | Python | py | 1,131 | no_license | """users table
Revision ID: 68f35de88272
Revises:
Create Date: 2018-06-28 10:46:32.599515
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '68f35de88272'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto genera... |
233dac32a01ea605057b8e0dfd30abace49151dd | e40cf5d9ce206589bc63480c86b88b552090871b | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/series/cd3d27e181ac4aef8f635a5b6a61d677.py | Python | py | 344 | no_license | class Series(object):
def __init__(self, data):
self.data = [int(c) for c in data]
def slices(self, num):
if num < 1 or len(self.data) < num:
raise ValueError("Invalid slice length for this series: %d" % num )
return [ self.data[i:i+num] for i in xrange(len(self.dat... |
9fbde42df386f1f9aa9ca0582aac1a315819ef75 | 85e5937202928f9df15dfe11eeb9858867c0f439 | rishitakalyani/schemaorg | /sdoapp.py | Python | py | 118,845 | permissive | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import with_statement
import logging
logging.basicConfig(level=logging.INFO) # dev_appserver.py --log_level debug .
log = logging.getLogger(__name__)
import os
import re
import webapp2
import urllib2
import mimetypes
import jinja2
import logging
import Str... |
586b06b0e56a5c921d5345e21d40883d8eeb757f | 1425d642f810dd2a76c979b1576cd27652b6df01 | lazypanda10117/CICSA-Ranking-Platform | /api/client_api/__init__.py | Python | py | 562 | no_license | from api.client_api.page_api import RegattasPageAPI
from api.client_api.page_api import ScoringPageAPI
from api.client_api.page_api import RotationPageAPI
from api.client_api.page_api import RegattasPageAPI
from api.client_api.page_api import LeaguePageAPI
from api.client_api.page_api import SchoolsPageAPI
from api.cli... |
e009d4d568a82c4cde9ebe25e5b583a2e8c81e5e | 9401ebbce9929140cb745e8745d1269ce07b5809 | nishit031/GDM-Education | /manage.py | Python | py | 671 | no_license | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Student_project.settings')
try:
from django.core.management import execute_from_command_line
exc... |
8871595bea12db0e6b8a5b9d676ff72ec6544d88 | 084e34024499b748d10c274aaf14c54d28303f5f | influxdata/influxdb-client-python | /influxdb_client/domain/list_stacks_response.py | Python | py | 3,018 | permissive | # coding: utf-8
"""
InfluxDB OSS API Service.
The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. # noqa: E501
OpenAPI spec version: 2.0.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa:... |
0f3caf834b3d14104ea19c493837baa7a861b1d8 | 482d52807d85e9a956310865e94084f3b9ef0d9a | rushioda/PIXELVALID_athena | /athena/Tracking/TrkExtrapolation/TrkExTools/python/TimedExtrapolator.py | Python | py | 6,519 | no_license | # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
######################################################
# TimedExtrapolator module
#
# it inherits from Trk__Extrapolator and uses
# the AtlasTrackingGeometrySvc
#
######################################################
# import the include state... |
14ab5df3b64cbcc5e1906802e16899f1fe4c48c6 | 8f8a88e602486eeeda4021f34cbec732cf853ae2 | dylan-hoffmann/Talk2Me | /src/start_actor.py | Python | py | 326 | no_license | import os
import sys
ERL_LIB_PATH = "../../erlport"
os.system('export GOOGLE_APPLICATION_CREDENTIALS="./Talk2Me-bc8da1a1de18.json"')
cmd = "erl -sname " + sys.argv[1] + " -setcookie Cake -env ERL_LIBS " + ERL_LIB_PATH +" -s distributor join " + sys.argv[2] + " " + sys.argv[3] + " " + sys.argv[4]
print(cmd)
os.system... |
b975ec0fb2d98604cd3f5940f1b90b69cc8660d3 | d229112d7c48867a2d85eea463ab56a2b879e2ce | ssss1029/PerceptualSimilarity | /compute_dists_one_vs_dir.py | Python | py | 1,571 | permissive | import argparse
import os
import models
from util import util
from models import dist_model as dm
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--image', type=str)
parser.add_argument('-d1','--dir1', type=str, default='./imgs/ex_dir1')
parser.add_argument... |
cac46b68e67de804d5809a1c00a6686b68a5920c | 553d336446f182e1bd146afcd97c6116a2bf2047 | KoushikMuthakana/django-rest-api | /RestAPI/RestAPI/wsgi.py | Python | py | 391 | no_license | """
WSGI config for RestAPI project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... |
2d591039fb3699b8254819f5d5ab8953c6d29c48 | eaa44a63fa5ab80ef684e1e7232049d568a2208f | dadbob/zerovm-docs | /zerocloud/snakebin/part3/get_file.py | Python | py | 1,280 | no_license | import os
from xml.sax.saxutils import escape
import snakebin
if __name__ == '__main__':
with open('/dev/input') as fp:
contents = fp.read()
http_accept = os.environ.get('HTTP_ACCEPT', '')
execute = os.environ.get('SNAKEBIN_EXECUTE', None)
if 'text/html' in http_accept:
# Something t... |
768569cfbc176e54543b85b76083f3802402b3ec | 6306280a0a9f9811569ebdbcf314c6d09861f5dd | Tobias-Braun/edbn | /Predictions/metric/__init__.py | Python | py | 461 | no_license | from Predictions.metric.accuracy import Accuracy
from Predictions.metric.cumm_accuracy import Cumm_Accuracy
from Predictions.metric.period_accuracy import Period_Accuracy
from Predictions.metric.brier import Brier
from Predictions.metric.precision import Precision
from Predictions.metric.recall import Recall
ACCURACY ... |
4d411151dccf72eadd8ed194d44aef3c6bf8bfef | 413cb05ad52584b92d956e718f69c8e623659420 | estherbli/Chess | /dpieces.py | Python | py | 2,090 | no_license | import pieces
#crée les pions
pionB1= pieces.pion( "blanc", 0, 1, 'pionB')
pionB2= pieces.pion( "blanc", 1, 1, 'pionB')
pionB3= pieces.pion( "blanc", 2, 1, 'pionB')
pionB4= pieces.pion( "blanc", 3, 1, 'pionB')
pionB5= pieces.pion( "blanc", 4, 1, 'pionB')
pionB6= pieces.pion( "blanc", 5, 1, 'pionB')
pionB7= pieces.pio... |
0931dafa9e8a09f107625c5b4e6a83437956d204 | fd3340ed2f859d9b1fb4679b4e3f2e6d10d33cf5 | wtrlulu/ultimate-python | /ultimatepython/advanced/decorator.py | Python | py | 3,809 | permissive | from functools import wraps
# Module-level constants
_MASKING = "*"
def run_with_stringy(fn):
"""Run a string function with a string or a collection of strings.
We define a custom decorator that allows us to convert a function whose
input is a single string into a function whose input can be a string
... |
ef32e1ac274c7151bf31728d42289aab6056a978 | 80db8ec88c04dac6b9bb2c73ecd38542f22ffea2 | MonikaLu/Sellpoint | /profiles/views.py | Python | py | 7,148 | no_license | import random
from django.contrib.auth import logout
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.contrib.auth.models import User
from django.http import HttpResponseRedirect
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib import messag... |
a1bd3b981a3d29f0ffadf607ca47bb45351ce903 | 103f55a9eb0d196d295653c891753eb0d3989d06 | love4code/sqlalchemy_examples | /SQLalchemy/ORM/QueryingData/limittingResults.py | Python | py | 559 | no_license | from db import *
# To limit the fields that are returned from a query, we need to pass
# in the columns we want in the query() method constructor separated by
# columns.
print(session.query(Cookie.cookie_name,Cookie.quantity).first())
# The output from the query where we sullpy the column names is a tuple of
# those c... |
2aa4098916e1487e35e27c5a6e9efbe4cd1f6402 | cfd78f160b8828f43a1c47aa7319668e390e7b55 | abhijit10m/MachineLearningCourse | /Assignments/Module02/SupportCode/Framework-5-UnderfittingVsOverfitting.py | Python | py | 9,707 | no_license | kOutputDirectory = "/Users/bhatnaa/Documents/uw/csep546/module1/MachineLearningCourse/MachineLearningCourse/visualize/Module2/Assignment5/"
import MachineLearningCourse.MLUtilities.Evaluations.EvaluateBinaryClassification as EvaluateBinaryClassification
import MachineLearningCourse.MLUtilities.Evaluations.ErrorBounds ... |
ffe7828f3b5ec670587070dbe055d48778f32e9f | 52b1e1f4ce0257aece26a0b98fb162c2598a6285 | facebookresearch/EGG | /egg/zoo/emcom_as_ssl/games.py | Python | py | 2,827 | permissive | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from egg.core.interaction import LoggingStrategy
from egg.zoo.emcom_as_ssl.archs import (
EmComSSLSymbolGame,
EmSSLSender... |
094ae6161c0b21a607534a401de68840349847f3 | f20730a94b8cc78a7201e44d23e1fd0586bc8127 | RamaSoni/otp_signup_restapi | /core/urls.py | Python | py | 819 | permissive | """core URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-... |
a9e84d4ba64e46b0a6e7e2bd4ffd0eb0659ee254 | 56c469eb07c164bf79a583ec62ef8d03e57213c2 | lmp199198/python | /limaopeng/test2/youjianfasong.py | Python | py | 2,140 | no_license | # -*- coding:utf-8 -*-
import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
from email.header import Header
my_sender='9****@qq.com' # 发件人邮箱账号
#my_pass = 'c____7***9st' # 发件人邮箱密码
my_pass = 'zwvjsvbsshbdji' # 发件人邮箱密码-此处为授权码,“'zwvjsvbsji'”
my_user='962769013@qq.com' # 收件人邮箱账号,我... |
1ef3621d45753c097ecca3439a685676ed2ed1b9 | e295a2ecb151b24907aca0349d90c47ee71178ea | levaspb/algorithms | /hoffman_decode.py | Python | py | 390 | no_license | count, lenght = map(int, input().split())
table = dict()
for i in range(count):
s, k = map(str, input().split(': '))
table[k] = s
encoded = input()
decoded = ''
while len(encoded) >= 1:
finished = False
howmany = 0
while not finished:
howmany += 1
if encoded[:howmany] in table:
finished = True
decoded += ... |
17b0978ebe289c01d529f494e51367c209d93a90 | 02557ed261fc5f108c86d9ae7fd8089da32c55d1 | wolski0420/SmartHomeRemoteControl | /GUI/HomeObjects/tlight.py | Python | py | 3,711 | no_license | from GUI.HomeObjects.tobject import *
from tkinter import Scale, HORIZONTAL, ttk
class TLight(TObject):
def __init__(self, send_func, light, master=None):
super().__init__(send_func, light, master)
self._power_property_label.configure(text="Power:")
self.__brightness_frame = None
s... |
25813b6692f40124141ccb6722c82e5abf89426f | 183609dc0215dd828accadd9fda1688668308483 | Deeshant2234/comm | /correlative-inferometer/3_DOA_estimation_MUSIC.py | Python | py | 1,999 | no_license | import numpy as np
import matplotlib.pyplot as plt
from cmath import e,pi,sin,cos
#if using termux
import subprocess
import shlex
#end if
N=5
M=10
p=100
fc=1e6
fs=1e7
c = 3e8
d = 150
#Steering Vector as a function of theta
def a(theta):
a1 = np.exp(-1j*2*pi*fc*d*(np.cos(theta)/c) * np.arange(M) )
return a1.re... |
a37be17b9c7a269561a5234719d3386b6e22a713 | 5f71877fd190304024ae2d5d0c6daab1dffb60e6 | jmirazee/qbb2019-answers | /week3/read_depth.py | Python | py | 7,960 | no_license | #!/usr/bin/env python3
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('ggplot')
"""
Usage: maing read_depth plot
the read depth distribution across each called variant
the genotype quality distribution
the allele frequency spectrum of your identified variants
a summar... |
0fd86e7e1cd54e35bdf2bfde76a3139a01ff68cc | 1f21be3304dd1d48df489b30d8a4ad12cf9d7420 | lzy7071/wc_rules | /wc_rules/rete_net.py | Python | py | 1,767 | permissive | from .indexer import SetLike
from .rete_nodes import Root, Complex
from . import gml
from collections import deque
class ReteNet(SetLike):
def __init__(self):
super().__init__()
R = Root()
self.add(R)
self._root = R
C = Complex()
self._complex_bookkeeper = C
... |
ec6a2c4b0350fbfc47f67b68570c2d9f3fa0d8a6 | 404b1cff1de22f3d777414d9f1cab20823af9c15 | jungaohzz/Practice_1 | /AutoTest/test2.py | Python | py | 1,607 | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Time : 2019/7/24 13:43
# Author: GaoJun
import unittest
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys # 键盘操作
from selenium.webdriver.common.action_chains import ActionChains # 鼠标事件
import pygame
from selenium.webdriver.supp... |
41ab463eddbbc22447210aab519133345563e2ed | 97dbc6fb014a6c3acd4e309ec323dedb1ede69c4 | feliperojas/mision_tic_G11 | /s5/1.6.1_asignacion_variables.py | Python | py | 758 | no_license | numero1 = 2
numero2 = 3
resultado = 0
resultado = numero1 + numero2
print("El resultado de la operacion es:", resultado)
resultado +=numero1 #resultado = resultado + numero1
print("El resultado de la operacion es:", resultado)
resultado *=numero2 # resultado = resultado * 3
print("El resultado de la opera... |
ea302474dee7636aead045933d5893515a52521a | 27182b67db03e82f775914c198adb74dbbe5530d | ch1huizong/study | /lang/py/pyadmin/02/test.py | Python | py | 230 | permissive | #! /usr/bin/env python3
# -*-coding:UTF-8 -*-
# @Time : 2019/06/13 22:44:56
# @Author : che
# @Email : ch1huizong@gmail.com
import os
def test():
print("hello world")
def say():
print("Good bye")
test()
say()
|
fd7613b2b1bf36c814b2ee8e006449f8b9d2c850 | df3f2efdb0c51a174bb41629f539a4dc93bf8d59 | Ecotrust/F2S-MOI | /moi/outcomes/migrations/0007_priorityoutcome_sort_order.py | Python | py | 489 | permissive | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-05-04 21:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('outcomes', '0006_auto_20160322_1733'),
]
operations = [
migrations.AddField(... |
24a4ce2b4e04c535f119b2e1896e7c239e8b36da | 13de888c56e3bef926703299298ae5c852aba5fc | LazarJovic/PredictNBA | /dataPreparation.py | Python | py | 4,141 | no_license | from collections import defaultdict
class DataPreparation:
def __init__(self):
pass
def prepare_data_frame(self, df, train):
# Uklanjanje duplikata utakmica
index_to_drop = df[df["teamLoc"] == "Away"].index
df.drop(index_to_drop, inplace=True)
df.reset_index(inplace=T... |
3f7777622f64b81272836e69adbfb9cd5df8d6e8 | 5fb0cb895c10c34bd62965fa345c0b6e94d8335a | falcon92/animeManga | /manage.py | Python | py | 542 | no_license | #!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'animeManga.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. A... |
4f36b593a99d02255bb2ea4bf7e4694e374f3b0f | e36757c284ad23bd3ab42798b21c8e2254130a94 | bachlee89/payment-gateways | /src/model/thread/connector.py | Python | py | 1,279 | no_license | import threading
from model.log import Log
from model.thread.spinner import Spinner
import sys
import time
class ThreadConnector(threading.Thread):
def __init__(self, name, connector, delay):
threading.Thread.__init__(self)
self.name = name
self.connector = connector
self.log = Log... |
a24f1b5f18ea6c5dd7ff1923a415fdf243aa7a91 | f3e53bbce9ff12e1b1b8547380b78a3ed31fb03b | SERIDJ/PJON-gRPC | /examples/clients/python/pjon_grpc_clientserver.py | Python | py | 1,329 | permissive | #!/usr/bin/env python
from concurrent import futures
import time
import grpc
import pjongrpc_pb2
import pjongrpc_pb2_grpc
import threading
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
class Arduino(pjongrpc_pb2_grpc.ArduinoServicer):
def RPiArduino(self, request, context):
print("Client-Server received: node_id=... |
4747bdbefc4f4e323060874d589f19330ceda407 | 2b5434d40237111868850debe0f953cc9cc72e0e | kaveh81/TestNG | /ivyrep/oldlayout/org.geotools/geotools/finder.py | Python | py | 521 | no_license | import sys, os
def do_or_die(cmd):
print cmd
if os.system(cmd) != 0:
print 'failed'
sys.exit(1)
files = [x.strip() for x in os.popen('find geotools-2.7-M1 -name "*.java" ').readlines()]
for clazz in sys.stdin.readlines():
clazz = clazz.strip()
clazz = clazz[:clazz.rfind('.')]
for f in files:
idx = f.find(c... |
9709d9f11f651473c2e65805e05aded080e90bcb | dc1d0407d7bfbf8e9c2910c6614f783f51b9b3c0 | chiseungii/baekjoon | /01193.py | Python | py | 217 | no_license | X = int(input())
n = 1
while (n * n + n) // 2 < X:
n += 1
an = (n * n + n) // 2
dis = an - X
if n % 2:
up = 1 + dis
down = n - dis
else:
up = n - dis
down = 1 + dis
print(up, '/', down, sep='')
|
bbff09385fc97a0c1c6527a37996a4ec24f6564a | 4219c4dedab9850a77dcb4e32255829b3acb7215 | agrif/hesperus | /hesperus/plugins/examples.py | Python | py | 1,569 | no_license | from ..plugin import Plugin, CommandPlugin, PollPlugin
import time
# a simple command-based plugin, note all commands will
# run in the same thread
class ExampleCommandPlugin(CommandPlugin):
@CommandPlugin.register_command("test (.*)")
def test_command(self, chans, name, match, direct, reply):
reply("g... |
2c23ff55b9e9469b4b078be0cfcb585f92b0f73f | 8adbc91e067819999f4fed4ef7d19f48c7335c78 | RSrscoder/Road-Extraction | /Tracer/remove_corners.py | Python | py | 1,661 | permissive | from rtree import index
def read_graph(graph_path):
graph_index=[-2,-2]
print("offset graph {}".format(graph_index))
size=1024
offset_x=graph_index[0]*size
offset_y=graph_index[1]*size
node_list=[]
with open(graph_path,"r") as f:
for line in f.readlines():
temp=line.stri... |
beedeb3148fcb2979365ab2e7b6386ff52671031 | 20eb9c9779a60e1f6c40f24db84d07d18d75391a | robertbenavidez/Algo_DS_Review | /recursion/decimalToBinary.py | Python | py | 250 | no_license | # Convert a dicimal to binary using recursion
def decimalToBinary(n):
assert int(n) == n, 'The parameter must be an integer'
if n == 0:
return 0
else:
return n%2 + 10 * decimalToBinary(int(n/2))
print(decimalToBinary(2)) |
8a3a368af20dca817c6c3f6928f74c20a03f9284 | 79bc3dbe1e7cccd4073ed10f8a6dcad98d579dcc | wind-meta/deep-learning-models | /img_similarity_calc.py | Python | py | 3,597 | no_license | """
Author: wutenghu <wutenghu@chuangxin.com>
Date: 2018/9/9
"""
import os
import sys
import time
import pickle
import numpy as np
import gflags
gflags.DEFINE_string('results_dir',
'results',
'path of the result dir')
gflags.DEFINE_string('feat_folder',
... |
5fd433592180d9461644bd1b2a1bd9685c38d260 | 90e46bb400caa60c22fbb5e2dc1479b651788092 | zaidkhider/factors_project | /venv/Scripts/pip3-script.py | Python | py | 424 | no_license | #!C:\Users\ZKhider\PycharmProjects\Deloitte_Project\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==19.0.3','console_scripts','pip3'
__requires__ = 'pip==19.0.3'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', ''... |
e5e7b51926d27b93ca00a21ee300f9e44b773aa4 | cbf28eb80fdc82c2e9ef9f8b1d73550a4b4e9ddd | chrisonabike/DOW-Topic-Modeling | /Feature Building For LDA.py | Python | py | 17,216 | no_license |
import pandas as pd
pd.options.display.max_columns = 50
import re
import nltk
from nltk.corpus import stopwords # Import the stop word list
#nltk.download() # Download text data sets, including stop words
from nltk.tokenize import word_tokenize
from nltk.corpus import wordnet
from nltk.tokenize import ... |
2fd1c19209dac931ee5c962784c0f353db8df3b0 | 3a0513710d332133dffdd202401294a8619c78d9 | rtacconi/oanda_requests | /main/utils.py | Python | py | 464 | no_license | """
Utils package with various function
"""
from collections import MutableMapping
def flatten(d, parent_key='', sep='_'):
"""
Make a dictionary flat, not netested
"""
items = []
for k, v in d.items():
new_key = parent_key + sep + k if parent_key else k
if isinstance(v, MutableMappi... |
aa1de115967b547966617af9986b14ac9087f8a6 | a082b54d83d08f2c4b351a85feaaa89cfc2e671a | Eeeeearl/web.py-0.33 | /build/src/code.py | Python | py | 8,781 | no_license | import json
import web
import cx_Oracle
import datetime
# 前面是url地址,
# 前缀:http://localhost:8080
# 后面的 映射下面的class类,GET请求,则调用GET方法!
urls = (
'/index', 'index',
)
render = web.template.render('../themes/')
class index:
def GET(self):
return render.index()
def POST(self):
print(datetime.date... |
fd4f961ed714303ee3d0ae642ae683e0408a9ff1 | 531ad30dc6565cd114aa4d86394f53563a755b2e | cormackikkert/competitive-programming | /ORAC questions/Air Drop/prog.py | Python | py | 556 | no_license | with open("dropin.txt") as file:
N = int(file.readline())
placed = [False for i in range(10000000)]
for i in range(N):
placed[int(file.readline())-1] = True
dp = [[1 for i in range(N)] for j in range(10000000)]
highest = 0
for x in reversed(range(N)):
if not placed[x]:
continue
dp[0][x] = 1
cur = x+1
for y... |
9c317a08f740195415e23123fe35271f8d7e2e53 | 41c4fae1e3610b45b5af1b91a116f233c57e8287 | lucasgsouza03/backend-challenge | /solution/PlanD_API/API/urls.py | Python | py | 463 | no_license | from django.conf import settings
from django.conf.urls.static import static
from django.urls import include, path
from rest_framework.routers import DefaultRouter
from API.views import PlacesViewSet
router = DefaultRouter()
router.register('place', PlacesViewSet, basename='place')
urlpatterns = [
#path(r'^api-au... |
4c993cf8c3292e8d1607bebd17efc2d02898559b | 135823c11582e4a66817f56c8d688506e6bed2f3 | keithpij/python-sandbox | /numpy/reshape.py | Python | py | 1,892 | no_license | '''
numpy.reshape
numpy.reshape(a, newshape, order='C')
Gives a new shape to an array without changing its data.
Parameters:
a : array_like
Array to be reshaped.
newshape : int or tuple of ints
The new shape should be compatible with the original shape. If an integer, then the result
will be a... |
1cc978f5c7ff9a2d2c1914b7cfccea9242e78488 | 29d4e2578815234b21b06606f7d9a1abf0824b55 | hkraw/ctf_ | /boiler/pwn/matrix/expl.py | Python | py | 1,769 | no_license | #!/usr/bin/python3
from pwn import *
from past.builtins import xrange
from time import sleep
import random
#libc
libc = ELF('./heapsoftrouble.libc')
#Utils
def create(name,population):
io.sendlineafter('Exit\n','1')
io.sendlineafter('Matrix: ',name)
io.sendlineafter('to new matrix: ',f'{population}')
def delete(m... |
eab7bca9854d169a22220de75f9e560cca3df0f0 | 28aeff4939d83e5ae08192e08623e4bc74c3c280 | rasheelprogrammer/pirates | /pirates/piratesbase/TODGlobals.py | Python | py | 13,622 | permissive | # uncompyle6 version 3.2.0
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
# Embedded file name: pirates.piratesbase.TODGlobals
from pandac.PandaModules import *
from pirates.piratesbase.TODDefs import *
from pirates.piratesbase.TODD... |
d1d349cab3703a817a1a8248cd4a82416f671430 | 3c889bea68119efe1f322b27348a5bab8e854883 | jbn/brittle_wit | /tests/unit_tests/app/conftest.py | Python | py | 443 | permissive | import pytest
import asyncio
from brittle_wit.app import App
from brittle_wit import AppCredentials, ClientCredentials
@pytest.fixture
def app_cred():
return AppCredentials('app', 'secret')
@pytest.fixture
def client_cred():
return ClientCredentials(1, 'user', 'secret')
@pytest.fixture
def app(app_cred):... |
9dd28560e40648ecab76c71e37ef96f7b97cf42f | 915ddf6a0dfab09828cda44e3cbdc1c6473ad7c0 | acutaia/IPT-anonymizer | /app/models/extraction/detection.py | Python | py | 1,346 | permissive | """
Detection Model
:author: Angelo Cutaia
:copyright: Copyright 2021, LINKS Foundation
:version: 1.0.0
..
Copyright 2021 LINKS Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the Lic... |
12f63736357a885393cde9edc8e0d73075f05689 | 72bf4b1c37a05030d6915c2635b8ae5ad5c0d669 | Hambbuk/kobot8-Turtlebot | /jjolbo-turtlebot/parking_sign.py | Python | py | 594 | no_license | import cv2
import numpy as np
cap = cv2.VideoCapture(0)
template = cv2.imread("표지판.png", cv2.IMREAD_GRAYSCALE)
w, h = template.shape[::-1]
while True:
_, frame = cap.read()
gray_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
res = cv2.matchTemplate(gray_frame, template, cv2.TM_CCOEFF_NORMED)
loc = np.... |
d886a83ed844776e693480fc326a862d737990b3 | c42726a413e9c495496b2dd88e7a44f4763ef7f9 | Batwang/qibuild | /python/qitoolchain/toolchain.py | Python | py | 5,620 | permissive | import os
from qisys import ui
import qisys.sh
import qitoolchain.database
class Toolchain(object):
def __init__(self, name):
self.name = name
self.feed_url = None
self.config_path = qisys.sh.get_config_path("qi", "toolchains",
"%s.xml" %... |
66e794f17c491ba8ac05efc499736db7fe740e12 | 88692f039a6f40a82f127b7c36e4437afa577525 | zbzzbd/python | /Count.py | Python | py | 246 | no_license | #-*-coding:utf-8 -*-
#用户判断质数
def is_prime(n):
if n <=1:
return False
for i in range(2,n):
if n % i ==0:
return False
return True
if __name__=='__main__':
print is_prime(13) |
ff20c0e2d47292b5bfbed390bd8b5b9068ab6b54 | afa46c283276e340c348d6f0b6c462f5f187e79a | vinayakvaid/spam-classification | /nlp.py | Python | py | 3,835 | no_license | def text_process(mess):
"""
1. remove punc
2. remove stop words
:param mess: string
:return: return list of clean text words
"""
nopunc = [char for char in mess if char not in string.punctuation]
nopunc = "".join(nopunc)
return [word for word in nopunc.split() if word.lower() not in ... |
a00992c5b33fff0c52f83c1d82a6fbde86b42536 | a232630595d73d73b9906a967358124b277b187e | cameronmathis/AuburnClasses | /COMP6700/Projects/Assignment3/tCurve/test/microserviceTest.py | Python | py | 11,711 | no_license | from unittest import TestCase
from tCurve.prob import prob
import http.client
from urllib.parse import urlencode
import json
class ProbTest(TestCase):
def setUp(self):
self.nominalN = 4
self.nominalT = 1.4398
self.nominalTails = 1
self.inputDictionary = {}
self.errorValue =... |
6ad32b105c49208de4d5df546a7bdf1d1c8e8591 | 3d6acec3ffdef7994e169b7f861079abb0cfc232 | thiippal/diagrams-genre | /01_extract_features_from_corpus.py | Python | py | 10,566 | permissive | # -*- coding: utf-8 -*-
"""
Usage:
1. Download the AI2D and AI2D-RST corpora as instructed in README.md
2. Run this script to build the AI2D-RST corpus using the following command:
python 01_extract_features_from_corpus.py
"""
# Import modules
import cv2
import networkx as nx
import numpy as np
impo... |
2a51671dd9bc964f4a0167e38453291c5560298a | 09cbcdf1dab60348dba041e8a8c4dfe2563e806a | dibyendu92/In-silico-Enymze-deisgn | /python_scripts/predict_from_double.py | Python | py | 6,519 | no_license | #!/usr/bin/env python
from itertools import combinations
import numpy as np
np.set_printoptions(threshold = np.inf)
mutation_list = ['G81A', 'R88S', 'T104I', 'N124T', 'T141N', 'T207M', 'T278S', 'D299N']
rotamer_list = [ 'c1', 'c2', 'c3' ]
single_state = []
twoD_list = []
store_line = []
single_store_line = []
bind_di... |
ca69e4a44507d5b05e33ff9d111f628878549be1 | 1cdc18f4861aa2d482281cb2afef8c09a31f4ccd | abhijitadhikary/Twitter-Sentiment-Analysis-using-LSTM | /dataloader.py | Python | py | 6,782 | no_license | """This file contains all of the code for
reading data and converting it to the appropriate form for models to use."""
from collections import Counter, defaultdict
import pandas as pd
import torch
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.pipeline import Pipeline
import... |
c07f0631e7907838201441df690c4329ef884706 | 900c661bfb16a71a01f302604ff549ce18a7f9e1 | ddurnell/python-challenge2 | /PyPoll/main.py | Python | py | 2,624 | no_license | import os
import csv
import sys
class Logger(object):
def __init__(self):
self.terminal = sys.stdout
self.log = open("results.txt", "w")
def write(self, message):
self.terminal.write(message)
self.log.write(message)
def flush(self):
pass
sys.stdout = Logger(... |
2462cd1221bd14b5537705c4955e9ac4be4d3c08 | 446020efdd3b16f1aad65ebf5c690c30390f32d7 | YucaiFan/dqnabc | /cartpole.py | Python | py | 4,456 | no_license | import gym
import tensorflow as tf
import random
import numpy as np
from collections import deque
class dqn():
def __init__(self, gamma, batch_size, env):
self.gamma = gamma
self.batch_size = batch_size
self.iter_times = 0
self.cache = deque()
self.eps = 0.5
self.d... |
7bc7988059dc8ddb4e0622cc1d66189c12126b3b | b8f6989a0df32092a4e68af75fefe7cd7b81e24c | MisinformedDNA/pulumi-azure-native | /sdk/python/pulumi_azure_native/purview/v20201201preview/__init__.py | Python | py | 1,334 | permissive | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from ._enums import *
from .account import *
from .get_account import *
from .get_private_endpoint_connecti... |
d6a173896b5a4ea5612ef7b5be8ac2e3b6c59eba | bdd547d19e67cb961870e3b6b3fcbe606aad798e | Hadryan/forgerydetection | /src/forgery_detection/data/fid/inception.py | Python | py | 11,418 | no_license | # https://raw.githubusercontent.com/mseitzer/pytorch-fid/master/inception.pyimport torch
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models
try:
from torchvision.models.utils import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import loa... |
a401bf759ecad8224c6d12c7bfa521d49f4adf4a | 3f156e2efa1e4724bd5a7af11bf13aadfc0fca75 | kowshikthopalli/EEE598_SML_project | /script/create_datasets.py | Python | py | 2,509 | no_license | from __future__ import print_function
import pickle
import numpy as np
import torch
from torchvision import datasets, transforms
from sub import subMNIST
transform = transforms.Compose([transforms.ToTensor(),
transforms.Normalize((0.1307,), (0.3081,))])
trainset_original = datasets.MN... |
954d08db89d0e6943497e1d89f137f104ea062c8 | 6aa4fa50e7543d45cb03635afb6f22c01ce211d2 | marius-pop0/AesDeepNetKeyRecovery | /aes.py | Python | py | 20,165 | no_license | import binascii
import re
class AES(object):
""" Started on 3/16/2017
The Advanced Encryption Standard (AES), also known by its original
name Rijndael, is a specification for the encryption of electronic
data established by the U.S. National Institute of Standards and
Technology (NIST) in... |
4c49e8f875002719e25ef17bc4a143bdc3f05a3f | 7da9db5ab5cfbda4fd66bfe64c4ba54b292405db | TarasStankovskyi/intership | /base_plugin.py | Python | py | 600 | no_license | import config
from storage import Storage, DatabaseConnection
from netaddr import IPAddress, IPRange
class BasePlugin(object):
def _store(self):
raise NotImplementedError('You need to implement this method')
def get_storage(self):
raise NotImplementedError('You need to implement this method... |
e413ecdbeb449f8dcb48264842f602cfb1448f02 | 80e1fc1aaf76194c5708f71581bdb6956edb1838 | marivipelaez/bicingbot | /tests/test_internationalization.py | Python | py | 1,383 | permissive | # -*- coding: utf-8 -*-
"""
Copyright 2016 Marivi Pelaez Alonso.
This file is part of BicingBot.
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
Un... |
a25f9d5431705d573db74c09aec8a1b0923e804b | 86cdf2d86878327f99f86945be41df004eb96388 | DerMetzger69/core | /homeassistant/components/incomfort/binary_sensor.py | Python | py | 1,414 | permissive | """Support for an Intergas heater via an InComfort/InTouch Lan2RF gateway."""
from typing import Any, Dict, Optional
from homeassistant.components.binary_sensor import (
DOMAIN as BINARY_SENSOR_DOMAIN,
BinarySensorEntity,
)
from . import DOMAIN, IncomfortChild
async def async_setup_platform(hass, config, as... |
b11bd1067bd35a3f0bee33f8ad9fea530ed35cc0 | 6745e8eecf9229ca970aebc752e6d7d39466fa7b | karoly-hars/gpt2_episode_summary_generator | /generate.py | Python | py | 2,948 | permissive | import argparse
import torch
from pytorch_transformers import GPT2Config, GPT2Tokenizer, GPT2LMHeadModel
from utils.gen_utils import set_random_seeds, generate_sequence
def generate_samples(args):
"""Use a pre-trained GPT-2 model to generate a set of samples from scratch."""
# Set seed
set_random_seeds(ar... |
6f0bb70b34f10e59bb6c240c75fd954d2901b0a2 | bb5d7ebf60fb0ebf262e6ce8cb1005aba7287466 | KaranToor/MA450 | /google-cloud-sdk/lib/surface/service_management/convert_config.py | Python | py | 3,746 | permissive | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
cef90d96bc6f6c762b5d78eff8bd2e689607b246 | 6cc099279030b47ff751b5211cc5f1ea9a4f1beb | optimal16/biandian_yolov5 | /src/loss.py | Python | py | 1,806 | no_license | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
e2e21337c948d1ee0f6f10491d052f689f81ca30 | 233bf48c15f905379233ad080d236084a6fc2805 | benonisilva/pdf-inbox-extractor | /string_util.py | Python | py | 2,885 | no_license | #!/usr/local/bin/python
# -*- coding: UTF-8 -*-
#Arrancador de acentos
#Copyright (2004) João S. O. Bueno
#Permissao para uso e modificacao conforme a LGPL.
#uso: check_alphanum (string) retorna verdadeiro se a string é imprimivivel
#strip_diacriticals : troca todos os acentos pelos equivalentes nao acentuados.
# ... |
517d4d0aecf31b0b55968fe183cd5f6be2e0d02c | 7c7dd7ac9613f9b69194f3b329b2e7c6965b0948 | pedrobranco0410/Self-driving-car-with-reinforcement-learning | /Used_on_raspberry/runInCircle.py | Python | py | 3,403 | no_license | """This code allows the car to run in circle for a certain period of time to measure the lateral acceleration and deduce the radius
of the circle that the car makes
We used this code to compute the relation between the command send to the servo and the turn radius of the car"""
import time
import pigpio
import RPi.GPI... |
3367c3f6677c896eca9bffdc6fe8c5d7e422dd1a | eda4a65860ccda8ef28f617628ab457cc5d9ea91 | GilesStrong/lumin | /lumin/nn/callbacks/abs_callback.py | Python | py | 996 | permissive | __all__ = []
class AbsCallback():
r'''
Abstract callback passing though all action points and indicating where callbacks can affect the model.
See :meth:`~lumin.nn.models.model.Model.fit` and :meth:`~lumin.nn.models.model.Model.predict_by` to see where exactly these action points are called.
'''
... |
bbb132301d69e56a0427c7d870a993495ce2edb0 | 5b4478a67122f204934f15cd4a5840a8f639a7ad | DawoonC/dw-wiki | /handlers/signupPage.py | Python | py | 1,819 | permissive | import handler
import utils
from data import User
class SignupPage(handler.Handler):
"""
Handler for user signup function.
Signed up user will be stored in DB.
"""
def get(self):
next_url = self.request.headers.get('referer', '/')
self.render("wiki_signup.html", next_url=next_url)
def post(self):
have_err... |
ab1584ca8a846f1c47884dba4d9f569ee8209579 | 7855d4e3900e4cda8606f6717fb7c9ff21a0a76f | akaDeMka/django_project | /bookshop/book/migrations/0012_book_format.py | Python | py | 431 | no_license | # Generated by Django 3.0.6 on 2020-07-12 18:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('book', '0011_auto_20200712_2153'),
]
operations = [
migrations.AddField(
model_name='book',
name='format',
... |
1c093edf2dc773323a5e43ee3fc3e2eeeef12060 | c7245515e0f39e7d2beb590435bebf046a155185 | AnthropocentricAI/fat-inspector | /app/blueprints/main.py | Python | py | 406 | permissive | """Main blueprint module for routes for the 'main' part of the app."""
from flask import render_template, redirect
from flask.blueprints import Blueprint
bp = Blueprint('main', __name__)
# this is a catch all route - any invalid route is redirected to the index
# the frontend handles the rest
@bp.route('/')
@bp.rou... |
3c4edc97cef4fdff7987e43f3135ebbc07798c10 | bd257776dbb133fe805be8636eb919efc26718e7 | matan1008/armulator | /tests/armv6_tests/opcode_tests/test_smc.py | Python | py | 822 | permissive | from armulator.armv6.opcodes.concrete.smc_a1 import SmcA1
from armulator.armv6.opcodes.concrete.smc_t1 import SmcT1
def test_smc_t1(thumb_v6_without_fetch):
arm = thumb_v6_without_fetch
arm.opcode = 0b11110111111100001000000000000000
arm.opcode_len = 32
opcode = arm.decode_instruction(arm.opcode)
... |
240df00c9c48cccbe9df0bdc1afb6ca589bb5679 | 3b6ed5299c1d2b57a98d9965e53b2f17577837f7 | thanawatpetchuen/nblogic-ec2 | /routes/nblogic_node.py | Python | py | 399 | no_license | import sys
import json
import nblogic
nb = nblogic.KLOGIC(apiMode=True)
args = sys.argv
username = args[1]
password = args[2]
mode = args[3]
if(nb.authentication(username, password)):
if mode == "authen":
nb.get_bio()
nb.get_information()
nb.get_program_course()
pr... |
d9e7727f60bd4d4a1d0d202ae1b69ccf27049afc | 9c09ff99ed51d81be90a584471fceaa5804da8ad | benjaoming/eggplant | /eggplant/roles/models.py | Python | py | 919 | no_license | from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
class RoleAssignment(models.Model):
PURCHASER = 'purchaser'
COMMUNICATOR = 'communicator'
PACKER = 'packer'
CASHIER = 'cashier'
ACCOUNTANT = 'accountant'
ROLE_CHOICES = (
... |
90064e576dbd5976ce45c001b809bd41d3fab06d | 4ba5bca97f08de5d1f8dc37ddb83ae04727f37da | sumittarwey/homeinabroad | /student_accomodation/views/city.py | Python | py | 1,283 | no_license | from student_accomodation.serializers.cityserializers import CitySerializer
from rest_framework import generics
from student_accomodation.models import City
from django.db.models import F
class list(generics.ListCreateAPIView):
queryset = City.objects.select_related('added_by').annotate(added_by_name=F('added_by_... |
87e4cbfa186b8ddb743f8609a9658444e8fa3348 | b39c4ee6371261c1886fea7098915e3e68b0d208 | djdkwel/info3180-project1 | /app/views.py | Python | py | 3,387 | 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 datetime
from app import app
from flask import render_template, request, redirect... |
03cd4b98f10133673170e5a941765d5aaa54b597 | 8c86eb69b9238d5e48fc1aff1e141712d57552c6 | shakythesherpa/network-planner-algorithm-tools | /batchPrims.py | Python | py | 14,710 | no_license | #!/usr/bin/env python
"""
Implements the "Composite Prim's" algorithm to estimate how optimal network cost
varies with penetration rate. Given a precalculated spanning network as a
shapefile, the script tests an input set of starting points and compiles the
results, returning the optimal cost for each penetration rate,... |
405218fd5d20bf6b0ddb11e120c17551cceb4e70 | 25a3b22f6a7211918d55c34a8bbe1b4ed9be4e70 | ceb10n/okerr | /okerr/ok.py | Python | py | 1,256 | permissive | from typing import Any, NoReturn
from .result import Result
from .unwrap_err import UnwrapErr
class Ok(Result):
def __init__(self, value: Any = True):
super().__init__(value)
def __eq__(self, other: Any) -> bool:
if not isinstance(other, Ok):
return False
return self.va... |
153b0c02278e33f9639d1a88916130ad4279f4ac | 16a6dc3cae400700bf94ad2cdde500e45841ed6f | angeloudy/lightbook | /production.py | Python | py | 5,378 | permissive | import sys
import logging
from gevent import monkey, wsgi
from flask import Flask, jsonify, request, g
from logstash_formatter import LogstashFormatterV1
from ldap import LDAPError
from ldap_api import requires_auth, SiteSettings
debug_mode = '--debug' in sys.argv
app = Flask(__name__, static_folder='build', static_u... |
a9a59785082d979b7701561fb5806026af5fab16 | 6ac8907679863070957aa1144d9fcfe13a5c0c43 | dizcology/googleapis-gen | /google/ads/googleads/v5/googleads-py/google/ads/googleads/v5/enums/types/app_campaign_app_store.py | Python | py | 1,174 | 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... |
8ebfee36053f2c8d1db9f1bba0108e89751f1b5b | efcbaeb0521a0cb3615380afd15eec022a6d3996 | Asnegha/MLIP | /flownet_train.py | Python | py | 12,784 | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 19 18:39:17 2021
@author: SRINIVAS
"""
import os
import cv2
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import tf_slim as slim #tensorflow.contrib.slim as slim
import random
import numpy as np
import shutil
import struct
import time
impo... |
efbaf9bbba15d90e456290fd83059072d97460b0 | 9bbee9c10b8095703fb4b1dee2f67616a708fd18 | gabrieledcjr/DeepRL | /dqn/dqn.py | Python | py | 8,854 | no_license | #!/usr/bin/env python3
import numpy as np
import logging
import os
from common.replay_memory import ReplayMemory
from common.game_state import GameState
logger = logging.getLogger("dqn")
def run_dqn(args):
"""
Baseline:
python3 run_experiment.py --gym-env=PongNoFrameskip-v4 --cuda-devices=0 --optimizer=A... |
0ad8bd364180c6fe4b3b57596022838846d0cc24 | 5e1b73a700e109013d7ecd394214b27f91fc2a15 | adityadu-18/IRC2020-Rover | /hello.py | Python | py | 300 | no_license | import numpy as np
import pyautogui
import imutils
import cv2
import sys
number = int(sys.argv[1])
print(number)
pyautogui.screenshot(str(number)+"screenshot.png")
image = cv2.imread(str(number)+"screenshot.png")
cv2.imshow(str(number)+"Screenshot", imutils.resize(image, width=600))
cv2.waitKey(0)
|
8ffc703efd01d54d483c1b558934e6bbfa026c6f | 54a42321b5fcda8ebdc2021e81818733cd80e9e2 | nanomishka/PayMarket | /backend/app/app/models/transaction.py | Python | py | 960 | no_license | import datetime
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import Numeric
from app.core.config import settings
from app.db.base_class import Base
class Transaction(Base... |
d6d858e190e42017043297f6d1086e0bfe1905a6 | e8bd4d2a9b8886fd7c9e8ffc64b5346983a3494f | superbag/superbag | /superbag/main/views.py | Python | py | 3,746 | no_license | # -*- coding: utf-8 -*-
# import traceback
from django.core import serializers
from django.core.mail import EmailMessage
from django.http import HttpResponse
from django.template import Context
from django.template.loader import get_template
from django.views.generic.base import TemplateView
from django.views.generic.... |
09f3bf0d76885fc1b857699efc7b049fda073902 | 76961b87901156096edd55b866053170a4049cea | iproduct/intro-python | /sdp_2021_04_data_structures/queue1.py | Python | py | 242 | permissive | if __name__ == '__main__':
queue = []
queue.insert(0, "One")
queue.insert(0, "Two")
queue.insert(0, "Three")
queue.insert(0, "Four")
queue.insert(0, "Five")
# FIFO order
while len(queue) > 0:
print(queue.pop()) |
d0abb7a744271f6abae35c6dc4b34f725ac326e5 | 62faf6fb608f200ce2cefa70ff3aed7b71574a22 | innatunieva/HW6 | /HW6.py | Python | py | 2,768 | no_license |
# coding: utf-8
# #Homework 6
# In[1]:
#1
# In[2]:
import quandl
with open('key_quandl.txt','r') as f:
key=f.read()
# In[3]:
data=quandl.get(['WORLDBANK/ARM_TOT','WORLDBANK/LUX_TOT'], authtoken =key, trim_start='1977-1-1', collapse='annual')
data.columns=['ARM_TOT','LUX_TOT']
data.head()
# In[4]:
impor... |
444b262a485448ea04615659d925a751e0df8d99 | a9109555f48bba428a12c46d2047c00fc8c5237b | Skeletonxf/Presentation-Blender | /Slicer.py | Python | py | 1,810 | permissive | from pptx import Presentation
import json
import copy
import six
import sys
import subprocess
json_data = json.loads(sys.argv[1])
# get input key from dictionary
data_list = json_data.get('input')
print("running")
# a slice of a presentation
class Slice:
def __init__(self, data):
self.filename = data.get... |
3e8e35834ac57d8b999bf5f1119ac321a9f7108f | dbd0f06134057d8cbbc8d0c21b8a20b9a78d16be | bwlynch/FbScraper | /migrations/versions/6924196dcf9f_add_article_type.py | Python | py | 728 | permissive | """add article type
Revision ID: 6924196dcf9f
Revises: 1e590240b89f
Create Date: 2020-01-14 12:28:55.741356
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "6924196dcf9f"
down_revision = "1e590240b89f"
branch_labels = None
depends_on = None
def upgrade():
... |
0edcca9150bf0013c2d6736ae9601044e1484d3d | 3d8f139be6ff1e69cb8ef0c1761bcb1e223379c3 | Mittenss2010/PythonPractice | /tests/工具-findContours 查找轮廓-匹配 hu 矩 .py | Python | py | 1,315 | no_license |
## 查找轮廓,打印轮廓数据结构
import cv2
img = cv2.imread('003.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
_, binary = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)
contours, hierarchy = cv2.findContours(binary, 3, 2)
for contour in contours: ## 多个轮廓
for item in contour: ## 一个轮廓
pr... |
df052453c1ee46f19d2b71ef1256acbad82e105c | 935e1996424e1e9aa8d3269322739d1e879ec497 | HLNN/leetcode | /src/1047-maximize-sum-of-array-after-k-negations/maximize-sum-of-array-after-k-negations.py | Python | py | 1,086 | no_license | # Given an integer array nums and an integer k, modify the array in the following way:
#
#
# choose an index i and replace nums[i] with -nums[i].
#
#
# You should apply this process exactly k times. You may choose the same index i multiple times.
#
# Return the largest possible sum of the array after modifying it in t... |
55ab26e07292c654a15fc246809426cb9f84fe81 | b3101010c2074cef1d69456506c6d5ac84dd9b61 | ZeroCool940711/NeverSink-Filter-Downloader | /setup.py | Python | py | 254 | no_license | from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
setup(
options = {'py2exe': {'bundle_files': 1, 'compressed': True}},
windows = [{'script': "NevrerSink Filter Downloader.py"}],
zipfile = None,
) |
325fc4a6bb84dcefd98495e91b233d3af0cee468 | ce560beaec054ea2bb6557fe8a708a2b877636d2 | ReneEmmaneel/fair-ranking-thesis | /framework/relevance_to_exposure_plot.py | Python | py | 2,150 | no_license | import matplotlib.pyplot as plt
import argparse, os
import sys
import pickle
import model_ranking
import loader
from training import RankSVM
import numpy as np
def validate_file(f):
if not os.path.exists(f):
# Argparse uses the ArgumentTypeError to give a rejection message like:
# error: argument i... |
17d8ef7f0a92fec76c20027942e1d709ff89b9f1 | 03dc86613f5b9802c22dbebc83432e3701004659 | cha-afk/Netflix-Support-Talker---Beta-Version-Open-source- | /start.py | Python | py | 2,774 | no_license | print("""
_____
/ ____|
| | _ __ __ ___ __ _ __ _ __ ___
| | | '__/ _` \ \/ / | '_ \| '__/ _ \ Facebook : fb.com/nayfercs
| |____| | | (_| |> < _| |_) | | | (_) | Telegram : @nayfercrax
\_____|_| \__,_/_/\_(_) .__/|_| \... |
0595397a45e1210cfa6d78b14db22532a3715460 | 4ebaba054019ebd015249694a8685c56fd271045 | dianaparr/holbertonschool-higher_level_programming | /0x05-python-exceptions/3-safe_print_division.py | Python | py | 274 | no_license | #!/usr/bin/python3
def safe_print_division(a, b):
result_div = 0
try:
result_div = a / b
return result_div
except ZeroDivisionError:
result_div = None
return None
finally:
print("Inside result: {}".format(result_div))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.