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 |
|---|---|---|---|---|---|---|---|---|
1bb006aa6c17c5c3378177057ba10e7615911d9e | 0342ec8cf9448317ab073004c1af9822cdd3f673 | leowu1205/codingape | /gg.py | Python | py | 511 | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 4 14:29:26 2021
@author: USER
"""
from mcpi.minecraft import Minecraft
mc = Minecraft.create()
from random import randrange
from time import time
def linearSearch():
sTime = time()
for i in range(1, 10000001):
if i == number:
p... |
76e377e5046a37296464dbceb2df247324914b7b | 5a803fc5677f5892c93140e7eeab6cbbab24f74b | RafaelRauber/DataPackL2 | /data/scripts/quests/27_ChestCaughtWithABaitOfWind/__init__.py | Python | py | 2,793 | no_license | # Made by DooMIta (ethernaly@email.it) and DrLecter.
# Visit http://www.l2jdp.com/trac if you find a bug and wish to report it.
# Visit http://forum.l2jdp.com for more details about our community and the project.
import sys
from com.guardian import Config
from com.guardian.gameserver.model.quest import State
from com.g... |
0f75c731aceb5a8480d380927bed4f3ca62e5200 | d6c7625aaec8fe9ad87dafc5a0c81c36442a51d8 | tpraxl/molecule | /molecule/logger.py | Python | py | 5,448 | permissive | # Copyright (c) 2015-2018 Cisco Systems, Inc.
#
# 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... |
98c38a18b1d7c18b4e78c4a5ee3c668c2a6d9046 | 5763fc6beb609c60d044ab2e88aefe63d5453d61 | flavienfr/bootcamp_ml | /day00/ex11/gradient.py | Python | py | 801 | no_license | def gradient(x, y, theta):
"""Computes a gradient vector from three non-empty numpy.ndarray, using
a for-loop. The two arrays must have the compatible dimensions.
Args:
x: has to be an numpy.ndarray, a matrice of dimension m * n.
y: has to be an numpy.ndarray, a vector of dimension m * 1.
theta: ... |
f0261b08db3dbd166f71e05bf3d45d632900e422 | 4ab6e35d585967f976633fcd5ebde63114769256 | tropiano/usercode | /Reduction/python/genZmumuPatAddOns_cff.py | Python | py | 4,076 | no_license | import FWCore.ParameterSet.Config as cms
#################################
# Z mumu with QED FS photons
#################################
## select gen muons from Z clustering with the possible QED Final State photon
# Gen Mu Minus Status 3 producer
genMuMinusStatus3 = cms.EDProducer('Status3MotherCombiner',
src ... |
8de12a5733b6da44985cdda0602fa93020a7b8e3 | 3e636facc6e36026c4563bb53226fcaeb9a954db | batxes/exocyst_scripts | /output_cog_tags/initial_4318.py | Python | py | 4,328 | no_license | import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... |
38a7936a46fbb82dcc578abc0c798f2236a337d6 | 99cf07b99205bb52ea7c90c573d772c94c9c6f39 | RaziqK/Stop-And-Wait_Protocol | /UDPTrans.py | Python | py | 777 | no_license | import socket
import pickle
import datetime
from packets import Packet
class UDPTrans:
def createSocket():
return socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
def createServer(port):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('', port))
return s
... |
dcf0765ce8f6da838721bfddc044e2d01a4d6e76 | f750eec073aeb3a8bf3bda375aa71e8e64761367 | mottaquikarim/pydev-psets | /pset_pandas_ext/101problems/solutions/p7.py | Python | py | 476 | permissive | """
7. How to get the items not common to both series A and series B?
"""
"""
Difficulty Level: L2
"""
"""
Get all items of ser1 and ser2 not common to both.
"""
"""
Input
"""
"""
ser1 = pd.Series([1, 2, 3, 4, 5])
ser2 = pd.Series([4, 5, 6, 7, 8])
"""
# Input
ser1 = pd.Series([1, 2, 3, 4, 5])
ser2 = pd.Series([4, 5, 6... |
fba8ad19839341f0e8c7028ebd3bcbb4a8df35f5 | 30dab27d82f139e38192458ecba223c75d67d674 | duhanmin/spark-deep-learning | /python/tests/horovod/runner_base_test.py | Python | py | 1,960 | permissive | # Copyright 2017 Databricks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
7253d2a0ce50301ec879226082cf963a00252a90 | 17cfd5fbcb7306a087d617d38001f797ec2badc9 | JamesVStone/swaglyrics-backend | /swaglyrics_backend/issue_maker.py | Python | py | 19,187 | no_license | import json
import os
import re
import time
import git
import requests
from flask import Flask, request, abort, render_template
from flask_limiter import Limiter
from flask_limiter.util import get_ipaddr
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime as dt
from requests.auth import HTTPBasicAu... |
05e2aa702cc21447c3c53839721c79b769ffca56 | 70597ea15014da53a906af518e09774af97f9b85 | texpomru13/espnet | /espnet2/text/text_preparation/stress_dictionary/test/test_stresses.py | Python | py | 7,528 | permissive | import os
import shutil
import tempfile
import stress_dictionary as sd
TEST_DICTS = ['test/test_dict.json']
TEST_NAMES_DICTS = ['test/test_names_dict.json']
def test_add_stresses_simple():
s = sd.StressDictionary(TEST_DICTS, "don't-load-any-dicts")
assert s.stress("Мама мыла раму") == "Ма+ма мы+ла ра+му... |
5b1926416a3455de9bbfd5f6cbbf1677f0b1a065 | 330900c547b9129a32eac40d860fbb7537f026e0 | rockNroll87q/backup_src_glasgow | /backup_srcs.py | Python | py | 5,384 | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Created on Monday - September 28 2020, 16:05:16
@author: Michele Svanera, University of Glasgow
crontab -e
# Weekly backup
0 20 * * 1 /usr/bin/python3 /home/micheles/Desktop/backup/backup_srcs.py
Usage:
* go to 'micheles-pc'
* crontab -e
* 25 19 * * 1 /usr/bin/pyt... |
f0e9cc2dfca2ce9ed90affc59baa7942e9b5bede | b9c8396743506147380b134eb4840ce3cd799474 | snashraf/scikit-bio | /skbio/sequence/_grammared_sequence.py | Python | py | 24,007 | permissive | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... |
c1ce84ca89bee8cce3e0563e9cf8425fb60094e6 | 96288f26cb264538da06b3f5cac5e3a13d31ac0a | dang666/APU-Modules-Rebuild | /FSD/Assignment 论文开发/UC1F1711/Other/1_List-of-List.py | Python | py | 3,124 | no_license | # store the profile? list or dictionary in list of list form
# like this : [ [],[],[] ]
import time
def create_profile():
"""create new Lecturer/ Academic Leader’s profile, attribute include name, age
type, teaching subject, date for enrollment, using list as data type to storing the profile"""
academ... |
2aa9af6b53ce56a935b011c09876f3ce2e249a91 | 19c125675430514fbf879a9112e91ba11c7d76db | obscode/snpy | /snpy/spline2/spline2.py | Python | py | 9,238 | permissive | ''' Spline2.py: wrapper for B. Thijsse et al.'s hyper-spline routines.
Yet another spline interpolation routine. The problem: given a set of
experimental data with noise, find the spline with the optimal number of
knots.
Solution:
They use the usual kind of routines to determine least-squares
splines from ... |
55230b1d9a2de8767dc3cf7d2fb233f41b5f4789 | c55afeabce843782591dd69109d34b528ce9c2ed | BackupTheBerlios/dss-svn | /dss-main/nomed/examples/lshal.py | Python | py | 2,220 | no_license | import dbus
if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
import dbus.glib
from utils.device import Device
import sys
device_udi = '/org/freedesktop/Hal/devices/volume_uuid_C025_4348'
udi_dict = {}
bus = dbus.SystemBus()
hal_manager_obj = bus.get_object('org.freedesktop.Hal', '/org/freedesktop/Hal/Manager')
hal... |
50556d706606d31ebbc446c6e7a2c6c25b4eb3e2 | ae6b1036ebd4cb000f3483e4182f1cac35c87179 | dhecar/SINERGIA | /sine_stock_invoice_onshipping/__openerp__.py | Python | py | 1,478 | no_license | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# Add auto validate and print Invoice
# David Hernández.
# (C) Sinergiainformatica.net (2016)
#
# ... |
2f19fbda8e412569519dbab9c8b3d550d272719e | c8fbe1d453d8051872e44c6fde08d1075d4f4e1c | wk1984/RPN | /src/misc_plots/lakes_glaciers_pf_veg.py | Python | py | 4,790 | no_license | import os
from matplotlib import cm
from matplotlib.colors import ListedColormap, BoundaryNorm
from matplotlib.patches import Rectangle
from mpl_toolkits.basemap import maskoceans
from netCDF4 import Dataset
from rpn.domains.rotated_lat_lon import RotatedLatLon
from scipy.spatial import KDTree
from application_proper... |
ef17737965672bff30d5d5763704d2e1bda5eddb | 19c903346fbe2286e19ab280c00ff7f19306f8fe | estudio89/e89-syncing | /e89_syncing/models.py | Python | py | 1,118 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
import e89_syncing.syncing_utils
from e89_syncing.apps import E89SyncingConfig
import json
class SyncLogManager(models.Manager):
def get_timestamps(self, user, default=""):
sl_list = self.... |
258f37cf846d537fe90d328566b68b43ef6a8bdf | 2041d4447179d95c4f4cd5107bf6b7c2f57af0d3 | 00mjk/iconfount | /scripts/correct-direction.py | Python | py | 447 | permissive | #!/usr/bin/env python3
import fontforge
import sys
def main():
argv = sys.argv;
if len(argv) < 4:
return;
ttfInput = argv[1]
ttfOutput = argv[2]
badGlyphs = argv[3:]
font = fontforge.open(ttfInput)
for codepoint in badGlyphs:
font.selection.select(('more', 'unicode'), int... |
d2f16d864a1cb82c50f39312d2c177f647326a8c | c81e7ebba090888e3bcc390fae97055bf8b10146 | sinozope/gxpy | /geosoft/gxpy/tests/test_dataframe.py | Python | py | 4,572 | permissive | import unittest
import os
import geosoft
import geosoft.gxpy as gxpy
import geosoft.gxpy.gx as gx
import geosoft.gxpy.system as gsys
import geosoft.gxpy.dataframe as gxdf
class Test(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.gxp = gx.GXpy(log=print)
@classmethod
def tearDownCl... |
ba68503fedf483fe8fb16d4aaa34e41564aa4a2a | 169c4e8b950e1bb5b84193d35bf85b2c0fb06990 | mtlberri/black-jack | /blackjack/blackjack.py | Python | py | 5,429 | permissive | import blackjackclasses as bj
from time import sleep
# Global parameters
initial_player_bankroll = 1000
initial_dealer_bankroll = 50000
minimum_bet = 10
class InvalidBetAmount(Exception):
pass
class InvalidAction(Exception):
pass
if __name__ == "__main__":
# Create the player, the dealer and set the... |
0ab848febdbe0de15e8cc8f2f517d7966d68f5dd | c51e205de97d141364f407f7db1cdbfa84bd0a44 | AkashSasank/basic-ml-dl | /3d.py | Python | py | 379 | no_license | import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
data = pd.read_csv(filepath_or_buffer='./housing.csv', delimiter=',')
x = data['median_income'][0:1000]
y = data['median_house_value'][0:1000]
z = data['population'][0:1000]
fig = plt.figure()
ax = fig.add_subplot(111, project... |
221813e432a1c791e826a5c1303212432fc43b86 | 2a13c46ae62ede9e5c994ccfbbdbcc21d0447680 | MikePTerp/recipe-app-api | /app/user/tests/test_user_api.py | Python | py | 5,102 | no_license | from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
CREATE_USER_URL = reverse('user:create')
TOKEN_URL = reverse('user:token')
ME_URL = reverse('user:me')
def create_user(**params)... |
d2334eba878e24d35690a816d2bfcce0c9635516 | 01e42da44cccc4156d0ed1e81e3522613891e51d | ekagra-ranjan/pytorch_geometric | /examples/graph_saint.py | Python | py | 3,445 | permissive | import os.path as osp
import torch
import torch.nn.functional as F
from torch_geometric.datasets import Flickr
from torch_geometric.data import GraphSAINTRandomWalkSampler
from torch_geometric.nn import SAGEConv
from torch_geometric.utils import degree
path = osp.join(osp.dirname(osp.realpath(__file__)), '..', 'data'... |
0e8e6b2984fed5ac249a6440eb969906dacdac24 | 2cb66ea88458a7fef4fe82f6674c80a2c84e0c32 | hsauro/PathwayModelingBook | /complexModel.py | Python | py | 9,259 | permissive | import pylab as plt; import numpy as np
import lmfit; import tellurium as te
import time; import copy; import random; import sys
import emcee
import time
import pickle
import pandas as pd
nsims = 0
def saveSampleAsPickle (sample):
with open ('samplePickle.pkl', 'wb') as f:
pickle.d... |
ac5d4d1bde704066c4c11aef41a4c9a780a36775 | c106c31b75b37758875aa9ba14817619fc7e1de9 | Tallesecs/CRUD-para-cadastro-de-estudantes | /venv/Scripts/pip3-script.py | Python | py | 423 | no_license | #!"C:\Users\Talles\PycharmProjects\Estudante Crud\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)?$', '',... |
034ea21cbf70c7f2f14e6896aab096830f037617 | f89eb505694155edababe8141a170fa161028689 | futurewq/ApiAutoTest | /day02/test_004.py | Python | py | 773 | no_license | '''
fixture 测试前置和后置,比较常用的方式
1.命名比较灵活,不限于setup、teardown 等命名方式
2.使用比较灵活
3.不需要import即可实现共享
'''
import pytest
# 测试前置
@pytest.fixture()
def login():
print("登录系统") # yield之前是前置
yield
print("退出系统") # yield之后是后置
# 测试脚本
def test_query():
print("查询功能,不需要登录")
# 使用方式一:将fixture作为参数传到脚本中,比较常用
def test_add(lo... |
4eddd77dbc901e6c556abb044e3a1eb4a4f3ff4a | 606f2fcca4afde9a35576ed24599cc222064f27c | chijuzipi/Journal_Collection | /utils/paperInfoGenerator.py | Python | py | 2,107 | no_license | '''
**************************************************************************
*********** The class is to generate invidiual paper url link
(c) 2015 by Chad Zhou
Northwestern University
**************************************************************************
'''
import time, datetime
import re
class Generator:
... |
385785ca80c7d919de2fe605184200ac6b5d3047 | bc2bc5932bf4f1b153e63e4d552aa43179e213c4 | kazuhiko1979/algo | /algo_sample/43_quiz_cache_memoize/main.py | Python | py | 545 | no_license | # Implements decorator to cache func
# from functools import lru_cache
import time
def memoize(f):
cache = {}
def _wrapper(n):
if n not in cache:
cache[n] = f(n)
return cache[n]
return _wrapper
@memoize
def long_func(num: int) -> int:
r = 0
for i in range(10000000):... |
2b07e15588ab210e0447c3508fe51a561c4220a0 | fba273722be0943aa7973ce70562414499bfbbc7 | abhishek52kj/Facial-Recognition | /OpenCVDemo/face_recog_dir/capture_training_dat.py | Python | py | 1,765 | no_license | import os
import cv2
from OpenCVDemo.face_recog_dir.face_normalisation import get_normalised_faces
cap = cv2.VideoCapture(0)
faceCascade = cv2.CascadeClassifier('C:\\Users\\anuj5\AppData\Local\conda\conda\envs\\face_recog_env\Lib\site-packages\cv2\data\haarcascade_frontalface_default.xml')
number_of_images_for_trai... |
1b013dc175b20801703622576d279a5a9f3692ed | 2da8b7417e3fe02ea8c9e42ab139574038d84de6 | ZuoMatthew/kenchi | /kenchi/outlier_detection/tests/test_cluster_based.py | Python | py | 566 | permissive | import doctest
import unittest
from kenchi.outlier_detection import clustering_based
from kenchi.tests.common_tests import ModelTestMixin, OutlierDetectorTestMixin
def load_tests(loader, tests, ignore):
tests.addTests(doctest.DocTestSuite(clustering_based))
return tests
class MiniBatchKMeansTest(
unit... |
42d7eabc23b96428e4be56d83c1ce51fdcfec90c | 9fefb9db2eb14fd5bc6160ce80af80c9b6acde30 | BenHuddleston/kv_engine | /scripts/jenkins_failures.py | Python | py | 12,434 | permissive | #!/usr/bin/env python3
"""
Copyright 2020-Present Couchbase, Inc.
Use of this software is governed by the Business Source License included in
the file licenses/BSL-Couchbase.txt. As of the Change Date specified in that
file, in accordance with the Business Source License, use of this software will
be governed by the... |
5286719aa2c8d359d7f70255a002ccc9166a109f | a2208dbd2bb1e419a48aa4ee2281fa794479625b | markus-beuckelmann/PhysicalQuantities | /tests/test_lists_arrays.py | Python | py | 1,111 | permissive | # -*- coding: utf-8 -*-
import PhysicalQuantities as pq
import numpy as np
def test_list_0():
""" wrap quantity around list """
a = [1,2,3] * pq.Q(1,'m')
assert str(a) == '[1, 2, 3] m'
def test_list_1():
""" access list via index """
a = [1,2,3] * pq.Q(1,'m')
assert str(a[0]) == '1 m'
def ... |
eb2822f6633523d8a5f773873ca83b2d84b369c7 | 65beffaa4a07a429ab2aedf6013dbcc0d1f944ad | kathy-jzh/CS224N_NLP-with-Deep-Learning | /assignment2/q2_parser_transitions.py | Python | py | 7,874 | no_license | class PartialParse(object):
def __init__(self, sentence):
"""Initializes this partial parse.
Your code should initialize the following fields:
self.stack: The current stack represented as a list with the top of the stack as the
last element of the list.
... |
9d1b6dfc23cd6ac3dfe77644b1bd41323dc69bda | 80966022a5818a2325a39d75329a7df1543bac70 | elinapark0818/Algorithm | /Backjoon/class_2/부녀회장(2775).py | Python | py | 991 | no_license | # a층의 b호에 살려면 a-1층 1호부터 b호까지의 사람들의 수의 합만큼
# 사람들을 데려와 살아야 한다.
# 0층부터 있고 1호부터 시작한다.
# 0층의 i호에는 i명이 산다.
# k층 n호에 몇 명이 살고 있는지 출력하라.
#
# T = int(input())
#
# for _ in range(T):
# k = int(input()) # 층
# n = int(input()) # 호
# result = [i for i in range(1, n + 1)] # 제일 아래층 사람 수
#
# for _ in range(k): # 층... |
517db5986bae66843ce45a8e2d369cf49ef94a72 | 01eb0e6d34025ac84176649f428cbdd63cbed3bd | csbridge/csbridge2020 | /templates/en/projects/medicine/soln.py | Python | py | 740 | no_license | """
File: medicine.py
-------------------
This program creates unique and hard-to-predict numbers that can
be put on packages of real medicine. People who buy the medicine
can text message the number on their package to tell if it's real.
"""
import random
NUM_PACKAGES = 1000
def main():
"""
Main ideas:
... |
ad0a3042b2002163eb0542c4dd21477cac3863f4 | c93b0d64d512ef7ed4d5387b720cafc03dd46eb0 | Sarmentor/statsmodels | /examples/python/discrete_choice_overview.py | Python | py | 2,637 | permissive |
## Discrete Choice Models Overview
from __future__ import print_function
import numpy as np
import statsmodels.api as sm
# ## Data
#
# Load data from Spector and Mazzeo (1980). Examples follow Greene's Econometric Analysis Ch. 21 (5th Edition).
spector_data = sm.datasets.spector.load()
spector_data.exog = sm.add_c... |
33e921433208666ed2885724b82eee7f9bda3ba4 | 849fe8e6193b5ccdaffe9eaafea9341982ff9a12 | tianjiwuhen7/TankWar | /src/food.py | Python | py | 2,261 | no_license | import pygame
import random
class Food(pygame.sprite.Sprite):
def __init__(self):
self.food_boom = pygame.image.load(r"D:\Python\tank\TankWar\image\food_boom.png").convert_alpha()
self.food_clock = pygame.image.load(r"D:\Python\tank\TankWar\image\food_clock.png").convert_alpha()
... |
f495f32b3253feab9e586049cfe0aca633a92227 | 1073f718395874bb942942be4191f78d5f336ba0 | CaimeiWang/python100 | /044.py | Python | py | 662 | no_license | #encoding:utf-8
##两个 3 行 3 列的矩阵,实现其对应位置的数据相加,并返回一个新矩阵:
##method1:
# import numpy as np
# a=[(1,2,3),(4,5,6),(7,8,9)]
# b=[(1,2,3),(4,5,6),(7,8,9)]
# c=np.zeros([3,3])
# for i in range(3):
# for j in range(3):
# c[i][j]=a[i][j]+b[i][j]
# print(a,b,c)
##method2
X = [[12, 7, 3],
[4, 5, 6],
[7, 8, 9]... |
83b91b9217223e8beaed6985c0cdc86fe1c6bd04 | 88e57004723d30d99608cc2c70f6f8b12ac0b25a | vachester/Gbn | /server.py | Python | py | 906 | no_license | #!/usr/bin/python2.7
# -*- coding:utf-8 -*-
import socket
import datetime
from Gbn import *
if __name__ == '__main__':
# 建立服务器端UDP套接字
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((HOST, PORT))
while True:
data, addr ... |
779d8fd5a26db46ddf87d1b6032535c0fb39fc1f | b5ceaf7f6ec59f3f68d2403261d109d96634b2db | ayushjain1144/vilbert-multi-task | /script/utils/utils_py.py | Python | py | 12,546 | permissive | import glob, math, cv2
import numpy as np
from scipy import misc
from scipy import linalg
EPS = 1e-6
XMIN = -5.0 # right (neg is left)
XMAX = 5.0 # right
YMIN = -5.0 # down (neg is up)
YMAX = 5.0 # down
ZMIN = 1.0 # forward
ZMAX = 11.0 # forward
def print_stats(name, tensor):
print('%s min = %.2f, mean = %.2f, ma... |
116289df4ba308de1f6307ce9e7d0ae3e2c3538c | 1d31bcb9035b361af4a927200db9d3b6094b2677 | ethansure/Leetcode | /H297-serialize-and-deserialize-binary-tree.py | Python | py | 1,284 | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string.
:type root: TreeNode
:rtype: str
... |
341f3a8790b505f6af87c2f626be26afa46c251a | 7823f5b49008545c13aa2c3e7211ae3d782e81cc | honkliu/March | /src/Python/PythonLearning/TFF/first.py | Python | py | 7,459 | no_license | #@test {"skip": true}
# NOTE: If you are running a Jupyter notebook, and installing a locally built
# pip package, you may need to edit the following to point to the '.whl' file
# on your local filesystem.
# NOTE: The high-performance executor components used in this tutorial are not
# yet included in the released pi... |
958c1ac7eafe7040e448d85b1aca706b0635e735 | 736ffe151c89e54b41856f7b95df9904013253da | horizonwht/crf | /model/rnn_crf.py | Python | py | 1,930 | no_license | #!/usr/bin python3
# -*- coding: utf-8 -*-
# @时间 : 19-4-4 下午6:15
# @作者 : Lin lifang
# @文件 : rnn_crf.py
import torch.nn as nn
from model.crf import CRF
from torch.autograd import Variable
import torch as th
class RNNCRF(nn.Module):
def __init__(self, vocab_size, embed_size, num_units, num_layers, num_tag, pre_t... |
959e35c9ee7f81e8c952495992a083619dd2af8e | e09c3d36bfa24c5ab8709249eb1c23a0a855f32c | Ajeetbisht/Django_ecommerce | /accounts/views.py | Python | py | 904 | no_license | from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from django.contrib.auth.models import User
from rest_framework_simplejwt.tokens import RefreshToken
# Create your views here.
class R... |
b3f47416b002bc1645d2aca889d09b5b1af37c2d | ecb43054b35ac4021a8f0efee89a1dcab64587fe | Aasthaengg/IBMdataset | /Python_codes/p02972/s676735253.py | Python | py | 312 | no_license | n = int(input())
a = list(map(int, input().split()))
ans = [0]*n
count = 0
for i in range(n-1, -1, -1):
c = sum([ans[j] for j in range(i, n, i+1)])%2
if c != a[i]:
count+=1
ans[i] = 1
print(count)
ans = [i+1 for i in range(n) if ans[i]==1]
if count > 0:
print(' '.join(map(str, ans))) |
015338f0b0e2c820acdc8cc2dd8d7c676fa1e2f5 | 2d8fbc76faacdd2c33503e89e6d3b07673b53d6b | 0xProject/web3.py | /tests/ens/test_setup_name.py | Python | py | 3,925 | permissive | import pytest
from ens.main import (
AddressMismatch,
UnauthorizedError,
UnownedName,
)
from web3 import Web3
"""
API at: https://github.com/carver/ens.py/issues/2
"""
@pytest.fixture()
def TEST_ADDRESS(address_conversion_func):
return address_conversion_func("0x000000000000000000000000000000000000... |
0c34b1196df59ef2388ea7c5a4f1ee5e2e9b8203 | b77f0f0f9e00c088b1f6bb97671318edd08ecf4c | EmilyWebber/amazon-sagemaker-examples | /sagemaker_neo_compilation_jobs/mxnet_mnist/mnist.py | Python | py | 6,123 | permissive | import argparse
import gzip
import io
import json
import logging
import os
import struct
from collections import namedtuple
import mxnet as mx
import numpy as np
def load_data(path):
with gzip.open(find_file(path, "labels.gz")) as flbl:
struct.unpack(">II", flbl.read(8))
labels = np.fromstring(fl... |
389fc9304ea1b85a642f94865a27a466535c4cba | 09ec5b5a8657ab3b4d1f58b98384b7257d03d474 | p0ete/CFF | /format_submisssion.py | Python | py | 448 | no_license | import os, inspect
import json
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
# os.path.join(currentdir,'my_solution', file)
submission = []
for file in os.listdir("./my_solution"):
print(file)
with open(os.path.join(currentdir,'my_solution', file)) as fp:
solution_tmp = js... |
76d44c6fd5f2f7f8a73a6149ac8216720b8e5d4e | 1416e08e85b05a29e865e4df16929e6c9e0ca19c | joao-afonso-pereira/Stock_Price_Prediction | /regression.py | Python | py | 11,422 | no_license | import numpy as np
import os
import glob
import datetime
import pandas as pd
pd.options.mode.chained_assignment = None
from sklearn.preprocessing import MinMaxScaler
import random
from sklearn.linear_model import LinearRegression
import calendar
from sklearn import svm
from sklearn import neighbors
from skl... |
bc5c2f2d08d93ee33a71f118381fc9197ff33a40 | 5082a1d800e489209d13a4a68ff7d03a1b78a45e | hattne/dials | /algorithms/symmetry/cosym/engine.py | Python | py | 2,939 | permissive | """LBFGS refinement engine for cosym analysis."""
from __future__ import absolute_import, division, print_function
import logging
logger = logging.getLogger(__name__)
import scitbx.lbfgs
class lbfgs_with_curvs(object):
"""Minimise a target function using the LBFGS minimiser.
Implementation of an LBFGS min... |
c2509f098fadc1bed66fe2c960e7ac6c126a9431 | be76f31f2834f26f9ef8384330f873f6b15b97c0 | mwcraig/gammapy | /gammapy/spectrum/crab.py | Python | py | 4,998 | no_license | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Published Crab nebula reference spectra.
The Crab is often used as a standard candle in gamma-ray astronomy.
Statements like "this source has a flux of 10 % Crab" or
"our sensitivity is 2 % Crab" are common.
Here we provide a reference of what the Cra... |
abf514dad2019e74e2c48f4d45e08e608f8c528e | 1d6f732189e25d9217d69754b8bd55ff3e90fd42 | vivek-narang/emissary | /python/tests/kat/t_extauth.py | Python | py | 42,520 | permissive | import json
import pytest
import os
from kat.harness import Query
from abstract_tests import AmbassadorTest, ServiceType, HTTP, AHTTP, AGRPC
from selfsigned import TLSCerts
from ambassador import Config
class AuthenticationGRPCTest(AmbassadorTest):
target: ServiceType
auth: ServiceType
def init(self)... |
db50f277d84fa3a9b640b463678c6eb7d8b14adf | c90840eecbb88684acdf83d0ef9cf3789e5ef4b1 | sebshub/twitterpibot | /twitterpibot/responses/test_response.py | Python | py | 2,729 | no_license | from unittest import TestCase
from twitterpibot.responses.Response import favourite_condition, retweet_condition, mentioned_reply_condition, \
unmentioned_reply_condition, one_in
__author__ = 'andrewtatham'
class TestResponse(TestCase):
def test_mentioned_reply_condition(self):
# noinspection PyType... |
0fcab2d953e30b32180191967fb4ff57223bca6c | 90faec9f2a00a7227ee0b68ba1ef0c2be4864de0 | AlbionaHoti/django_user_dashboard | /apps/main/urls.py | Python | py | 1,262 | no_license | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name="index"),
url(r'^create/$', views.create, name="create"),
url(r'^create_user/$', views.create_user, name="create_user"),
url(r'^dashboard/$', views.dashboard, name="dashboard"),
url(r'^logout/$', views... |
0e4b91495a7a4e01445b6431f1a2ca1b50452ac9 | 2405fd2491ad6a944ac6930d1d4da66d69a7dc2c | SREERAGI18/chromium | /testing/buildbot/scripts/upload_test_result_artifacts.py | Python | py | 7,446 | permissive | #!/usr/bin/env python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Uploads test results artifacts.
This script takes a list of json test results files, the format of which is
described in
https://chr... |
1babf31abafddc35ca9a443708bf2735eadcd2bc | 74af22b899541e77d4f0d8c92ff262e38abd9040 | Rajan2201/python | /linked.py | Python | py | 1,797 | no_license | class Node:
def __init__(self,data):
self.data=data
self.address=None
class LinkedList:
def __init__(self):
self.head=None
def insertatbeg(self,data):
newnode=Node(data)
newnode.address=self.head
self.head=newnode
def anyposition(self,data,pos):
... |
8074e83595b06701cbe1116f15dd1e4fb9d77c43 | f57fa0eeca6f76f5ada7b16dfb0655b2f8069ee3 | asimyildiz/webservice-for-xibo1.7-python | /src/models/media/textmedia.py | Python | py | 3,461 | no_license | # To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
__author__ = "asim"
__date__ = "$19.Eki.2015 20:03:23$"
import settings
from .media import media
from models.options.textoptions import textopt... |
b1cc84960965887a9aeb63e535dd7dc6f04edb1c | b9d307c92e8cdd7d722524fb5140d8f6b194fac2 | genesofeve/DeepGMAP | /deepgmap/data_preprocessing_tools/genome_labeling2.py | Python | py | 5,810 | permissive |
import glob as glb
import sys
import numpy as np
from sklearn.decomposition import KernelPCA as pca_f
import os
import matplotlib.pyplot as plt
from scipy.spatial.distance import pdist
import scipy.cluster.hierarchy as sch
import time
import copy
def genome_label(bed_file_list, genome_1000,out_dir):
file_num... |
e92816cb9b21d70705c648585574fdf11533b760 | 03ee908c9fbd140ac93d04653628f36c79f61196 | itunom/interop | /client/auvsi_suas/client/client.py | Python | py | 15,392 | permissive | """Core interoperability client module
This module provides a Python interface to the SUAS interoperability API.
Users should use the AsyncClient to manage the interface, as it has performance
features. A simpler Client is also given as a base implementation.
"""
import json
import requests
from auvsi_suas.client.ex... |
76488d187722de4e6cbae3031adde1de2ec64f11 | 3f662258ec447e3acc8e21c5d212519e6ca87e0c | zahessi/unileaks | /mine/eratosphen.py | Python | py | 305 | permissive | def eratosphen(n):
primes = [2]
divisable = None
for i in range(3, n):
divisable = False
for n in primes:
if i % n == 0:
divisable = True
break
if not divisable: primes.append(i)
return primes
print(eratosphen(100000))
|
55a583bb7b9c8b5301c68cf2780223ec27033aae | 3229fd4671d8e747192e876b19e002bdba8f5784 | haghft/matterllo | /core/hook/checklist.py | Python | py | 1,788 | permissive | from core.hook import BaseHook
class Hook(BaseHook):
def addChecklistToCard(self, action):
data = action['data']
context = {
'card_link': data['card']['shortLink'],
'card_name': data['card']['name'],
'checklist_name': data['checklist']['name'],
}
... |
c9f1c6eeb974b0e9c6a9cb5a9ad32ce1f13baf84 | 1c82ac080418f3098f36ae91000673cbad6570a3 | Sajid-Hameed63/Family-Tree-Structure-using-Prolog-language | /Code/python/python_code.py | Python | py | 20,462 | no_license | from pyswip import Prolog
class Prolog_Interface:
prolog = None
def __init__ (self):
self.prolog = Prolog()
self.prolog.consult("PROLOG (1).pl")
def run_query(self,qury):
return self.prolog.query(qury)
def print_family_members(self):
print("\t\t\t\t\t The family members ... |
7a7d6ae5b801d22ad82b26d0e6ae0693bcc6a48f | b4044217792cce0a4a8c69e11ca89ef2da2c2e06 | idaholab/raven | /tests/framework/ROM/TimeDepSKL/projectile.py | Python | py | 4,115 | permissive | # Copyright 2017 Battelle Energy Alliance, 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 agreed t... |
a27a3bddeeeb3b21878f3ea1694d7b943c8ac41d | c6a8fa01b8b13dcedcda29d6fe2340b74b8bebe8 | PIVX-Project/PIVX | /test/functional/p2p_addrv2_relay.py | Python | py | 2,526 | permissive | #!/usr/bin/env python3
# Copyright (c) 2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test addrv2 relay
"""
import time
from test_framework.messages import (
CAddress,
msg_addrv2,
... |
21d0984ef337721dcf7707589788aea8b6c83518 | 08edb48231272ad8224ada8837d571fa807762e4 | mbeslic99/zadatak4 | /Trokut.py | Python | py | 1,574 | no_license | import math
lista_stranica=[(1,2,3),(3,4,5),(3,4,4)]
class Trokut(object):
def __init__(self,a,b,c):
self.__a=a
self.__b=b
self.__c=c
if (self.__a<0 and self.b__<0 and self.__c<0):
print("Nije trokut")
else if(((self.__a+self.__b)<self.__c) and ((self.__a... |
8544f205fd98f3220b6483312f6d7eb7500edc68 | 79c00989d6ea3bcfcfd2993ef00de849ad1ae676 | Rombur/vim_config | /.vim/templates/presentation_tex.py | Python | py | 2,663 | no_license | #! /usr/bin/env python
#----------------------------------------------------------------------------#
# Python code
# Author: Bruno Turcksin
# Date: 2011-10-21 09:22:37.226201
#----------------------------------------------------------------------------#
print ("\documentclass{beamer}")
print ("\usepackage[T1]{fontenc... |
d5898ce0428e75a39a937a553981b49c36a323c4 | 7b83c399809282b1d719f0a5a2a6e61d3e13fb65 | rmodi6/scripts | /practice/Leetcode/3473_teemo_attacking.py | Python | py | 435 | no_license | # https://leetcode.com/explore/challenge/card/september-leetcoding-challenge/557/week-4-september-22nd-september-28th/3473/
class Solution:
def findPoisonedDuration(self, timeSeries: List[int], duration: int) -> int:
ans = 0
prev_until = -1
for time in timeSeries:
until = time +... |
e91167d4fa2c7abf920c9b50cf07ec3bf6487ad8 | c3fe88db683b9e08c59145b4577b8792643bbcd3 | linovskiy/sample-box-connector | /connector/app.py | Python | py | 1,141 | permissive | import logging
import sys
import socket
import os
from flask import Flask, jsonify
from werkzeug.contrib.fixers import ProxyFix
from connector.config import Config, check_configuration
from connector.v1 import api_bp as api_v1
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
stream = logging.Strea... |
6b7a5a60ab8f0a49e8d3796d3626fecf9dcb61bd | c414c67ce123a084339f63dbda47953c01894a39 | Jang-Jaewon/airbnb-clone | /reviews/admin.py | Python | py | 259 | no_license | from django.contrib import admin
from . import models
# Register your models here.
@admin.register(models.Review)
class ReviewAdmin(admin.ModelAdmin):
"""Review Admin Definition"""
list_display = (
"__str__",
"rating_average",
)
|
b4ed5256e609141b48e23c18d220c309c6c68ed4 | 882423ed51aae6bff58bb6400c6cf60e88b2fe8a | GodelTech/superset | /superset/utils/core.py | Python | py | 53,212 | 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... |
fe88763a5852b920adc2a9f01dca2ec2e4737aee | bd8fceb6d9539f2e728a88745d9b76e3bd3865cf | s0i/flairbot | /main.py | Python | py | 9,388 | no_license | # -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import praw
from termcolor import colored
import time
#Log into PRAW with script credentials
r = praw.Reddit('<your login credentials>')
print(colored('Logged in as: ' + str(r.user.me()), 'green'))
#Generate comm... |
9c5f0b0b25e5ffb29c91c36b9fa0477a4433ad57 | 30becd9217a7381ad0a65f751ce484f939ca3dc3 | montj2/valarie | /dev5/interface/httpsint.py | Python | py | 3,830 | no_license | #!/usr/bin/python
################################################################################
# HTTPS INTERFACE
#
# Justin Dierking
# justin.l.dierking.civ@mail.mil
# (614) 692 2050
#
# 07/27/2017 Original construction
################################################################################
SES... |
f9b27bdb635d8bd930715714fd4b29b821a1fa57 | 0bbc78f458f4741de7c2663b0cc93c697236bcf4 | webclinic017/Trend_Analysis_Scripts | /Example_sen_fit.py | Python | py | 495 | no_license | import numpy as np
t = np.arange(1,127,1)
y = t + 2.5
a = 2.5
s = 0.25
n = 126
data = s*t + a
y1 = data[0:63]
y2 = data[63:126]
# below using equations from Sen 2017 - Innovative trend significance test nd applications
# slope
s_calc = 2*(np.nanmean(y2)-np.nanmean(y1))/n
# intercept
t_bar = np.nanmean(t)
y_bar = n... |
c723374fc9e1b47f89432c2947720cc4c4fc0bc5 | 91f5e8cfdf1e011cd0a32faafff54ba8ce72e7b0 | aduner/Collection-of-crawler-items | /easy project/落户/crawl.py | Python | py | 1,531 | no_license | import pymongo
import requests
from lxml import etree
import json
headers = {
'Host': 'fuwu.rsj.beijing.gov.cn',
'Origin': 'http://fuwu.rsj.beijing.gov.cn',
'Referer': 'http://fuwu.rsj.beijing.gov.cn/nwesqintegralpublic/settleperson/settlePersonTable',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64;... |
c75a112a90934798d1b74500348f5cc1e900701f | c864e7db3f130eac717f8d14b8b5272c8c1c163a | coinwarp/dogeparty-lib | /dogepartylib/lib/messages/execute.py | Python | py | 7,030 | permissive | #! /usr/bin/python3
"""Execute arbitrary data as a smart contract."""
import struct
import binascii
import logging
logger = logging.getLogger(__name__)
from dogepartylib.lib import (util, config, exceptions)
from .scriptlib import (utils, blocks, processblock)
FORMAT = '>20sQQQ'
LENGTH = 44
ID = 101
def initialise... |
db24295de768c3631b1bac15617e1ae3ef225d2f | b82a314964b8d3da9bc8449dd0afdc28b7f5de79 | leonardt/ctree | /ctree/types.py | Python | py | 997 | permissive | import abc
from ctree.nodes import CtreeNode
from ctree.visitors import NodeVisitor
class CtreeType(CtreeNode):
def codegen(self, indent=0):
raise Exception("%s should override codegen()" % type(self))
def as_ctypes(self):
raise Exception("%s should override as_ctypes()" % type(self))
d... |
4313949afcec2038de0ff77f8676d3eacf8cfec7 | bb31c2203dfe99942d5f5b4a504ab0a913ca6046 | shen-huang/selfteaching-python-camp | /19100305/findyourselfloveyourself/d12_training2.py | Python | py | 390 | no_license | from wxpy import Bot,Message,embed
def main():
bot = Bot() #登录微信的命令
my_friend = bot.friends() #发给所有好友
@bot.register(my_friend)
def SHARING_Msg(msg):
if msg.type == 'Sharing':
msg.reply(msg.url)
else:
print('waiting......')
embed() #保持监听状态
if ... |
a86e71a9330c2194c7219a52e463e4ae6ee3bdc8 | cd14dd3b35b1ff58ac4addbab4334b9986c6c392 | Xi-Plus/NKUST-Data-Compression | /hw-4.py | Python | py | 592 | no_license | m = 8
data = [
[139,144,149,153,155,155,155,155],
[144,151,153,156,159,156,156,156],
[150,155,160,163,158,156,156,156],
[159,161,162,160,160,159,159,159],
[159,160,161,162,162,155,155,155],
[161,161,161,161,160,157,157,157],
[162,162,161,163,162,157,157,157],
[162,162,161,161,163,158,158,158],
]
minp = min(sum(data, [... |
6f2408904fd38bb2b8c37def3bc4939f7f5fe801 | 1676c822e0aca91c10967227b627ec9b18830590 | nyasuh/dot | /.config/sublime-text-3/Packages/Markdown-preview/lib/markdown_preview_lib/pygments/lexers/actionscript.py | Python | py | 11,203 | permissive | # -*- coding: utf-8 -*-
"""
pygments.lexers.actionscript
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for ActionScript and MXML.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import re
from ..lexer impo... |
3d63e5d39c8c9b2be1b395daaaeffce210935e96 | 23bcb13e565b396cf34a23ab688d3633cc7949ff | uwescience/twittervaccine | /queries/anova.py | Python | py | 6,080 | no_license | import pandas as pd
import pymysql
import scipy.stats
import numpy as np
import matplotlib.pyplot as plt
import collections
import sys
# Hack: append common/ to sys.path
sys.path.append("../common")
from db import get_database_connection
# Use SQL to compute the average sentiment score per user.
# Drop state-only e... |
9c5529e37ab6965682bb0c195f2f1cb777312d84 | 1d6e52bbd2e309764c409c0c5ed0537553a9f24b | Abhra303/vulnerablecode | /vulnerabilities/tests/test_safety_db.py | Python | py | 6,933 | permissive | #
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/vulnerablecode/
# The VulnerableCode software is licensed under the Apache License version 2.0.
# Data generated with VulnerableCode require an acknowledgment.
#
# You may not use this software except in comp... |
798a8373f5cf5be771960fe29ddedfc4be43b8ef | 96cc1e865f57b8b5c668d21703639ffea87fac61 | odecsarrollo/07_intranet_proyectos | /proyectos/migrations/0043_remove_miembroliteral_puede_ver.py | Python | py | 341 | no_license | # Generated by Django 2.0.4 on 2018-10-02 16:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('proyectos', '0042_auto_20180926_0941'),
]
operations = [
migrations.RemoveField(
model_name='miembroliteral',
name='puede_ve... |
9e27341e3bb2e558f998b5e47c036e04660bf6b2 | 5810e7e9259de58b51b3d3ba826f121a5d29505c | attraylor/metagrok | /metagrok/exe/head2head.py | Python | py | 4,203 | permissive | import argparse
import json
import logging
import math
import os
import textwrap
import random
import gevent
from metagrok import battlelogs
from metagrok import config
from metagrok import formats
from metagrok import torch_policy
from metagrok import utils
from metagrok import mail
from metagrok.pkmn.games import G... |
8891fb90700e2d7c1c26a9c0f8ed0a784dc6e524 | 68e8b9b4260f743d4ba7e1019206a537acc979c6 | Parallel-in-Time/parallel-in-time.github.io | /bin/arxiv_to_publications_detect.py | Python | py | 2,807 | no_license | import json
from urllib.error import HTTPError
from urllib.parse import quote_plus, urlencode
from urllib.request import urlopen, Request
from Levenshtein import ratio
import bibtexparser
def crossref_query_title(title):
EMPTY_RESULT = {
"crossref_title": "",
"similarity": 0,
"doi": ""
... |
fc1e3f22f6e9107ce6c053d1ec2ae091741b697a | 02f3c30c8701cea0f42843a1a8efdcede801ae90 | sergiu-corbu/Python__code | /oop/dunder_methods.py | Python | py | 347 | no_license | class Atom:
def __init__(self, label):
self.label = label
def __add__(self, other):
return Molecule([self,other])
class Molecule:
def __init__(self, atoms):
if type(atoms) is list:
self.atoms = atoms
sodium = Atom("Na")
chlorine = Atom("Cl")
salt = Molecule([sodium, chlorine])
... |
49373236f18ffe297704706df561ee76e00f2148 | fdd20f5d9da46c5e3aa03f012ffaa2484338e264 | dennis-me/Pishahang | /osm/SO/common/python/rift/mano/sdn/accounts.py | Python | py | 5,072 | no_license |
#
# Copyright 2017 RIFT.IO Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
343759e48e2b4d698d803d34b4d77e473f248aa5 | d0ea06186c0fd48ea8f298ab2672bb0f3a5923c1 | AlekhAvinash/Crypto-Solutions | /Cryptopals16(func2).py | Python | py | 1,500 | no_license | from Crypto.Cipher import AES
import binascii
key = b'\xd9Z\xbb\xe1Y"\x80\xc8\xabF\xa6\xba\xbb\x9du\x03'
IV = "a"*16
counter=0
def byte_flip(pt,ct,idx,aidx,trgt,ctrl=-1):
attack_byte = b''
for i in range(ctrl*-1):
attack_byte += (str(hex(int(ct[aidx+(i*2):aidx+(i*2)+2],16)^pt[idx+i]^trgt[i]))[2:]).encode()
resul... |
5572d09f3fa2c02a92cce508a2bf29a35448ba6f | 4dd4249265977734221e7ee49b8a634414b780ef | wpumacay/RoboND-Rover-Project | /code/SimServer.py | Python | py | 1,488 | no_license | # Do the necessary imports
import socketio
import eventlet
import eventlet.wsgi
from flask import Flask
from io import BytesIO, StringIO
sio = socketio.Server()
app = Flask(__name__)
g_cppBrain_sid = -1
@sio.on( 'cppBrainConnect' )
def cppBrainConnect( sid, pData1, pData2 ) :
global g_cppBrain_sid
g_cppBr... |
9c5f47ba1fb68d13294a381f97a0a2280adac7c5 | 9ee96444be031c914d688eefd04d6edafccd7ea2 | SarthakSinghal15/Data-Sharding-Rest-API | /consistent_hash.py | Python | py | 2,681 | no_license | import requests
import copy
import sys
import csv
import hashlib
import json
class Hashring():
def __init__(self,servers):
self.servers=servers
self.serverkeys=[]
self.serverdict={}
if servers:
for i in servers:
ser_h_key=self.add_server(i)
... |
7fbdcfeb8836e7b6aefd762bff7f0b5cd5d10ef8 | ce93a80534c875a753badad0fd84ef5627dd7ff3 | ophirg123/Homework_4 | /auv_interface.py | Python | py | 2,688 | no_license |
class Auv:
def __init__(self, _sonar_range, _sonar_angle, _map_size, _initial_position, _velocity, _duration, _mines_map):
''' init method for class Auv.
Input _sonar_range - An integer with values between 3-9, denote the range of the sonar
_sonar_angle - An integer with values between 15... |
a14073b6d930cce9c7ec2abb6d28509783379767 | cd5ce480c8826045b4f2770096b3ffe02b637913 | VikrantKumar121/Face_Mask_Detector | /train_mask_detector.py | Python | py | 5,304 | no_license | # USAGE
# python train_mask_detector.py --dataset dataset
# import the necessary packages
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.applications import MobileNetV2
from tensorflow.keras.layers import AveragePooling2D
from tensorflow.keras.layers import Dropout
from tenso... |
c0a5ad30c11f4492f58b31fb0c2444d0593b0ea4 | 5bfddec647f44bada0974416f58074fddd5df301 | altskop/house-cat-bot | /dashboard/app/src/draw_wrapper.py | Python | py | 3,664 | permissive | # Copy of draw_wrapper.py in house cat bot
# TODO find a better way to use this in both places (package it?)
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
SMALLEST_FONT = 6
class GeneratorDraw(ImageDraw.ImageDraw):
def draw_field(self, number, x, y, w, h):
x2 = x + w
... |
6e82d3c410d9d8fabe190e15f36c755afdb6fa53 | 538dbeb4813010683cfe7e1ad53f43d52cf64eb2 | pradeep90/pyre-check | /client/commands/v2/tests/start_test.py | Python | py | 19,801 | 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 tempfile
from pathlib import Path
from typing import Iterable, Tuple
import testslide
from .... import command_arguments, commands, c... |
a942fbdca75e07bffcab4315ebd818f1a73a5b49 | f8723e123b496ea29840ed1370e40d113c23df5d | lotusPlant/CvPytorch | /src/datasets/pennfudan.py | Python | py | 5,231 | permissive | # !/usr/bin/env python
# -- coding: utf-8 --
# @Time : 2021/3/15 14:17
# @Author : liumin
# @File : pennfudan.py
import os
import torch
from glob2 import glob
import numpy as np
from torch.utils.data import Dataset
from PIL import Image
from ..utils.coco_utils import convert_to_coco_api
'''
Penn-Fu... |
d9973b75754bc54179efe88ea7ce840a6da69f65 | 521948d87d3ea8c7e670688b950f97194cce67e2 | panosvag/P18014-Python-Exercises | /exer_9_max_Sequence.py | Python | py | 1,495 | no_license | def maxSequence(l):
newlist = []
final_list = []
max = -1
for k in range(0,len(l)): #Για κάθε στοιχείο στην λίστα
end = 1
for i in range(0,len(l)): #Δημιουργεί όλους τουσ δυνατούς δυνδιασμούς λιστών
s = 0
newlist=[]
for ... |
68503e8488cef357aec12de5d2a99cbd8173ff00 | 9615d9e5aaa7d3428b3bb094a317d6adeb857260 | BaburinAnton/lesson2 | /Lesson 2/hw 2 n 6.py | Python | py | 1,880 | no_license | products, order = [], 1
title, price, amount = None, None, None
while True:
if title is None:
tmp = input('Введите название товара: ')
if not tmp.isalnum():
print('Наименование товара не может быть пустым. Попробуйте еще раз.')
continue
title = tmp
if price is ... |
6d19628f3961bc9a4147df71bcc4ad06f92b4b95 | f19ed0d79afbcbd65fd3c8486d9d8df888f930c0 | dougvanhorn/bots-grammars | /x12/4051/252004051.py | Python | py | 4,076 | no_license | from bots.botsconfig import *
from records004051 import recorddefs
syntax = {
'version' : '00403', #version of ISA to send
'functionalgroup' : 'IE',
}
structure = [
{ID: 'ST', MIN: 1, MAX: 1, LEVEL: [
{ID: 'BGN', MIN: 1, MAX: 1},
{ID: 'DTP', MIN: 0, MAX: 99999},
... |
34bd42530092d1c0d96ee0872971c97c3d10e442 | 5b6642a281b3fcca8c5065f519d2b39ccc60a390 | abbashir/SKF_Alexa_Sales_Skills | /.debug/alexaReport/.~c9_invoke_wE6ft3.py | Python | py | 76,054 | no_license | import json
import boto3
import pandas as pd
import datetime
# -----------------------Function for own library ------------------------------
def get_time_stamp():
client = boto3.client('s3')
path = 's3://erpalexa/TimeStamp.xlsx'
df = pd.read_excel(path, header=None)
return str((df.loc[1,0]))
def ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.