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 |
|---|---|---|---|---|---|---|---|---|
c40063774916d869771a93bdbbb5e35772c43c61 | f87a883070eda14e1a989e187770736a90e8271a | gnoluna/HAABSA | /dataReader2016.py | Python | py | 10,098 | no_license | import os
import json
import xml.etree.ElementTree as ET
from collections import Counter
import string
import en_core_web_sm
en_nlp = en_core_web_sm.load()
import nltk
import re
import json
import numpy as np
nltk.download('averaged_perceptron_tagger')
pattern = 'NP: {<DT>?<JJ>*<NN>}'
parser = nltk.RegexpP... |
6cc9a7d28fddafc25c1cc4f08c224022d075df5b | 036cd35d983d51933f7810d456a4ffd73bd3071b | jfernand196/Ejercicios-Python | /crear_vari_lista.py | Python | py | 228 | no_license | #Crear variables a partir de los valores de una lista
numeros = [2, 3, 5, 7]
dos, tres = numeros[:2]
print(dos, tres)
tres, siete = numeros[1], numeros[-1]
print(tres, siete)
tres, _ , siete = numeros[1:]
print(tres, siete)
|
710fee5f24324bf7dae1f8e96bf0c08bca53929d | b3911e7aee25c3be1fdce1c67e21c76ee3e01a42 | andme/CouchPotato | /app/lib/cron/renamer.py | Python | py | 17,789 | no_license | from app import latinToAscii
from app.config.cplog import CPLog
from app.config.db import Movie, RenameHistory, Session as Db, MovieQueue
from app.lib.cron.base import cronBase
from app.lib.qualities import Qualities
import fnmatch
import os
import re
import shutil
import time
import traceback
log = CPLog(__name__)
c... |
9d1b9a31bdfcabe1990e3d2f2245a478a6d3a949 | cec3ced1d7d80ffec982c95d2bdd71b088b4751f | abhijitadhikary/EEG-conditional-feature-filter-GAN | /prepare_dataset/prepare_dataset.py | Python | py | 854 | no_license | import os
from prepare_dataset.split_dataset import SplitDataset
from prepare_dataset.generate_eeg_images import GenerateEEGImages
from prepare_dataset.generate_dummy_identities import GenerateDummyIdentities
from prepare_dataset.perform_grand_average import PerformGrandAverage
from prepare_dataset.generate_joint_train... |
8578b41b76c897016d1f0eb9ad27484f69256e76 | 79748416d129ee7f5f4466ae76eb42e7a8cbab83 | Gojay001/Python | /OpenCV/trackbar.py | Python | py | 865 | no_license | import numpy as np
import cv2 as cv
def nothing(x):
pass
# Create a black image, a window
img = np.zeros((300, 512, 3), np.uint8)
cv.namedWindow('image')
# create trackbars for color change
cv.createTrackbar('R', 'image', 0, 255, nothing)
cv.createTrackbar('G', 'image', 0, 255, nothing)
cv.createTrackbar('B', '... |
ec080aff0f856f1fe833fb3a486007958e2146ae | 6bb42d0de7b05ead8b3dc9825ed7a9af08d47bb1 | WSWCWaterDataExchange/DataMigrationScripts | /Colorado/WaDE2.0/sites.py | Python | py | 5,260 | permissive | #!/usr/bin/env python
import pandas as pd
import numpy as np
from sodapy import Socrata
import os
import beneficialUseDictionary
"""
Comments from Adel
1) we want to get the unique sites here. so could you filter the whole table based on a unique combination of site ID, SiteName, and SiteType?
2) We probably... |
4aabaf997bf67ed3b5f37c49f455efa5a08412ff | 5655e73b0713789f66cf62b5ee7f3b4cfe06f4b7 | bopopescu/profile.matcher | /stopwords/test/modulo.py | Python | py | 1,475 | no_license | import os
import sys
import inspect
import datetime
# Get the current folder, which is the input folder
current_folder = os.path.realpath(
os.path.abspath(
os.path.split(
inspect.getfile(
inspect.currentframe()
)
)[0]
)
)
folder_parts = current_folder.split(os... |
af92dce35f705d38297888700192eac7b7f085e1 | 7aa759b4e648fd293d73614ba8f8d5f859789692 | Dagorik/Travesia-backend | /teams/teamsapp/migrations/0009_auto_20190409_1907.py | Python | py | 626 | no_license | # Generated by Django 2.1.2 on 2019-04-09 19:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('teamsapp', '0008_checkpoint_num_checkpoint'),
]
operations = [
migrations.AlterField(
model_name='checkpoint',
name=... |
73f1f76a8ed2337bbd838208ac5dc8b1c7b8706d | e17a061b8ef447ee2bc01439d89050458e23d2e9 | grad-kushal/CSCI603 | /HW3/sunstar.py | Python | py | 4,061 | no_license | """
Filename: sunstar.py
Description: Assignment for Lab 3 of CSCI 603
This program draws a polygon with a particular pattern for
the sides sides.
Language: Python 3
Author: Arjun Kozhissery (ak8913@rit.edu)
Kushal Kale (ksk7657@rit.edu... |
dff4d5819ae2e2a94b1e46ec6941823f1a2ab8b4 | 41016cc42fcfe7f55cdc811eb0cf4ab62b5394ca | arthurDz/algorithm-studies | /leetcode/minimum_cost_for_tickets.py | Python | py | 2,363 | no_license | # In a country popular for train travel, you have planned some train travelling one year in advance. The days of the year that you will travel is given as an array days. Each day is an integer from 1 to 365.
# Train tickets are sold in 3 different ways:
# a 1-day pass is sold for costs[0] dollars;
# a 7-day pass is... |
946a72bf57b565bca1e15ef67f0d80db7b80a807 | e5967d9f31f8e21f8475270a7ea0e94c4b689c95 | rs00353729/python_practice | /1.Practice_BasicPython.py | Python | py | 13,891 | no_license | '''
Last amended: 06/04/2020
Objectives:
i) Learn python data structures
ii) Opening and reading file
iii) Iterating over sequences with for-loop
iv) List/dictionary comprehension
v) Writing functions in python
vi) Writing classes in python
'''
# 1.0
%reset -f # ipython magic com... |
7bed8dca7f2b76a3a3b030aa1b1843539e124224 | 4fd9f3057d617abbdf6efac9a1089b010b462794 | parinita08/Hacktoberfest2020_ | /Python/BST_implementation.py | Python | py | 2,187 | permissive | class Node:
def __init__(self,value):
self.leftkey = None
self.rightkey = None
self.value = value
#Function to print inorder traversal of tree
def printInorder(root):
if root:
printInorder(root.leftkey)
print(root.value),
printInorder(root.rightkey)
... |
6f378a21749ce58d60b1d50d32dfe2bf375e0c65 | 67cfcbefc3346a5b2178d1d9f388e93c6201bfe8 | oianson/ciscoisesdk | /tests/models/validators/v3_0_0/jsd_d24a3f485ff758d099b1e4713f18f1c1.py | Python | py | 2,902 | permissive | # -*- coding: utf-8 -*-
"""Identity Services Engine getCertificateProfileById data model.
Copyright (c) 2021 Cisco and/or its affiliates.
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 r... |
c7ffcb5414fe1493378e1333cabca4593feeeeb0 | 2bd6513b6e56bc013062c58d7c5960809a6a3954 | murradkh/StockProject | /myapp/scheduler/stock_api_update.py | Python | py | 2,966 | no_license | from myapp.models import Stock, WatchedStock, BoughtStock, SoldStock
from django.db.models import F
from myapp import stock_api
from django.db import transaction, IntegrityError
from datetime import datetime
MAX_UNNEEDED_HISTORY_TO_PRESERVE_IN_PORTFOLIO = 20
def stock_api_update():
start = datetime.now(datetime.... |
4208f2516c1115fbed1eb646a14c6f6c5d49545e | 61d883695cf31376b00db143122ec82c2ad6d222 | searay0/medical-device-design | /python/test_ble/hrm_demo.py | Python | py | 854 | no_license | #!/usr/bin/python
# -*- encoding: utf-8 -*-
import pexpect
import time
#gatttool -i hci0 -b D3:E0:D2:08:2B:8F -t random --interactive
#char-read-hnd 0x0029
addr = "D3:E0:D2:08:2B:8F"
try:
gt = pexpect.spawn("gatttool -b " + addr + " -t random --interactive")
gt.expect(r"\[LE\]>")
gt.sendline("connect")
gt.expe... |
a9275a962b9ce5103d67732c9e9f435e5ed9fbcf | 3243bcc1c334cb27e6e96b4d27ffb279395e792d | Ahmed--Mohsen/leetcode | /course_schedule.py | Python | py | 2,004 | permissive | """
There are a total of n courses you have to take, labeled from 0 to n - 1.
Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]
Given the total number of courses and a list of prerequisite pairs, is it possible for you to finish all... |
91cc9997f6e63c3b9ff05612cdf1c5ea62565555 | 7743d9be0837c0c414711ce97ca1bb59c7282f22 | webclinic017/gotolong | /django_gotolong/dematsum/models.py | Python | py | 1,471 | permissive | # This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior
# * Remove `managed =... |
5a2b1f5550f989a883d61ef17e5cefe8c4b09bd6 | 0d7d3197a5298b4b85f53df8548d81e85871a4bc | airuibel/python-1 | /spark/crm/PROC_F_CI_CLASSIFY_RESULT.py | Python | py | 7,784 | no_license | #coding=UTF-8
from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext
from pyspark.sql.types import *
from datetime import date, datetime, timedelta
import sys, re, os
st = datetime.now()
conf = SparkConf().setAppName('PROC_F_CI_CLASSIFY_RESULT').setMaster(sys.argv[2])
sc = SparkContext(conf = conf)
... |
9215c1e9057b5b93451069c2fe4f49f92d4a386a | 36444bada8da27127858d645350b3724f88e7b43 | fujicoin/fujicoin | /test/functional/wallet_fallbackfee.py | Python | py | 1,647 | permissive | #!/usr/bin/env python3
# Copyright (c) 2017-2022 The Fujicoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test wallet replace-by-fee capabilities in conjunction with the fallbackfee."""
from test_framework.b... |
8c04255c6951d2369f6f6fd3776a73b0d8d48af0 | 846d53113e0f442b3876fb14f98f70ba4e2f1fe5 | renxiaoqi/JingDong | /mysql/test06回滚.py | Python | py | 836 | no_license | # 导包
import pymysql
# 创建链接
conn = pymysql.Connect(host="localhost",
user="root",
password="root",
port=3306,
database="books",
charset="utf8")
# 获取游标
cursor = conn.cursor()
# 执行sql语句
try:
sql = "inser... |
2a87753c667815bfba12b5884321cafde166c98c | 94caf7ceb0574799446e6a503c13f9e3cd8f65d5 | PSU-OIT-ARC/runcommands | /runcommands/runners/remote.py | Python | py | 7,062 | permissive | import atexit
import getpass
import sys
from functools import partial
try:
import paramiko
except ImportError:
paramiko = None
else:
from paramiko.client import AutoAddPolicy, SSHClient
from paramiko.ssh_exception import SSHException
from ..exc import RunCommandsError
from ..util import Hide, printer
... |
5b8bba77bad10301b1e6db4309ad5d1d7adc3cf6 | 8f250528d8c1820cfb9813e938b3495863863a7a | alshamiri5/TUID | /vendor/mo_logs/log_usingFile.py | Python | py | 1,175 | no_license | # encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import
from _... |
56e64df8153cb8c677b9468eb0b9e01a90a0c66e | c15251d65a818276c922a77e9e4818b3e0578889 | brennoneves/tutorial | /helloworld/migrations/0001_initial.py | Python | py | 906 | no_license | # Generated by Django 3.0.4 on 2020-03-26 19:52
from django.db import migrations, models
import django.db.models.manager
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Funcionarios',
fields=[
... |
88e7461007b19f14adb3a470d43e34aa91ee5c30 | 8f383d7556d27104e3aac56a6d13f6fc4969d649 | schio/algorithm_test | /programmers/camouflage.py | Python | py | 313 | permissive | """
https://programmers.co.kr/learn/courses/30/lessons/42578
"""
from collections import defaultdict
from functools import reduce
from operator import mul
def solution(clothes):
category = defaultdict(lambda: 1)
for c in clothes:
category[c[1]] += 1
return reduce(mul, category.values()) - 1 |
7926b37db55b33c31cf0e44fc71645e4a0dfa5b4 | 54cd1060250ed1bcc166680e24cf5d5f81fd8176 | kelsohmm/hubtracker | /scraping/activity_report.py | Python | py | 691 | no_license | import json
from scraping.types import UserKey, ProjectKey, ReportEntry
def get_report_entries_from_json(report_json):
result = []
for project in _get_projects(json.loads(report_json)):
project_key = ProjectKey(project['id'], project['name'])
for user in _get_project_users(project):
... |
f9c5fd604ea89b2e02c77176f03282358d29b908 | b11202eda8065eb09ce9ee7d14b65d32745d2e7d | wanyikang/dsap | /stacks_queues_deques_ch06/reinforcement/reverse_deque_with_queue_r6_13.py | Python | py | 614 | no_license | # -*- coding: utf-8 -*-
from collections import deque
from my_queue_r6_11 import MyQueue
from exception import Empty
def reverse_deque(d, q):
""" reverse a deque with queue, no other variables."""
try:
while True:
elmnt = d.pop()
q.enqueue(elmnt)
except IndexError:
p... |
aa6a75ee894eee7765e7eef432510560c13e33f0 | f6a51d10b25ccb48dd0460dc1afd2d57cdc73bc9 | fabienblin/BootCampML42 | /day04/ex01/YoungestFellah.py | Python | py | 496 | no_license | import pandas as pd
from FileLoader import FileLoader
def YougestFellah(array: pd.DataFrame, year):
a = {"f":0, "m":0}
is_year = array["Year"] == year
year_array = array[is_year]
is_homme = year_array["Sex"] == "M"
is_femme = year_array["Sex"] == "F"
hommes = year_array[is_homme]
femmes = ... |
85fcb70d3df21fa90a77cf5c15ca02e6a0b0a57f | 45ca09bd9cf2a90788fe701590244d81d94e85c6 | colin-scott/sts | /config/pox_list_violation.py | Python | py | 1,034 | no_license |
from experiment_config_lib import ControllerConfig
from sts.topology import MeshTopology
from sts.control_flow import Replayer
from sts.simulation_state import SimulationConfig
controllers = [ControllerConfig(cmdline='./pox.py --verbose --no-cli openflow.of_01 --address=__address__ --port=__port__ sts.syncproto.pox_s... |
e25c2ef54055154579ccc4c4d14014d5073cce40 | fbb987bcd7765e39b1d7925f48d96aede6d617d1 | YijunXieMS/azure-sdk-for-python | /sdk/network/azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/_load_balancer_probes_operations.py | Python | py | 8,309 | permissive | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
f530c8676b58fe13373eeecc72795b71b1af8390 | acedce9d6b17747f3d330a381b4215979cc8c70a | Aasthaengg/IBMdataset | /Python_codes/p03699/s007619481.py | Python | py | 1,688 | no_license | import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log,gcd
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bi... |
7808b47370ce47366abe4d417140192d344be1c2 | 4af23c43ea78f8525b9d3ef4276b37c464fbe7e8 | OAID/Tengine | /examples/classification_timvx.py | Python | py | 2,995 | permissive | from tengine import tg
import numpy as np
import cv2
import argparse
import os
import time
import numpy as np
import time
DEFAULT_LABEL_FILE = "./synset_words.txt"
DEFAULT_IMG_H = 224
DEFAULT_IMG_W = 224
DEFAULT_SCALE = 0.017
DEFAULT_MEAN1 = 104.007
DEFAULT_MEAN2 = 116.669
DEFAULT_MEAN3 = 122.679
parser = argparse.Ar... |
53bec225c352478a6aa369a72893571705203224 | b01a94450f338570df088425b6b5153ad8836afa | Adasumizox/ProgrammingChallenges | /codewars/Python/4 kyu/RangeExtraction/solution.py | Python | py | 414 | no_license | def solution(args):
out = []
beg = end = args[0]
for n in args[1:] + [""]:
if n != end + 1:
if end == beg:
out.append( str(beg) )
elif end == beg + 1:
out.extend( [str(beg), str(end)] )
else:
out.append(... |
c3b55c2ed073296cab61aa48812aaa92c939320d | 080b89e12f85053da2a0bd791523d6cbb2c29809 | Vealor/flask_template | /src/models/_enums.py | Python | py | 345 | no_license | import enum
################################################################################
# ENUMS
class Actions(enum.Enum):
create = "create"
modify = "modify"
delete = "delete"
class Roles(enum.Enum):
basic = "basic"
admin = "admin"
@classmethod
def list(cls):
return list(map(... |
bc1fa7d1ccd5fbb1e195d7cd48c9a5af9b60b416 | cf742019e2e8ee04c82891439de5829a03ac74a7 | Shuaiyicao/leetcode-python | /70.py | Python | py | 324 | no_license | class Solution:
# @param n, an integer
# @return an integer
def climbStairs(self, n):
if n < 2:
return 1
dp = [ 0 for i in range(n + 1) ]
dp[0] = 1
dp[1] = 1
for i in range(2, n + 1):
dp[i] = dp[i-1] + dp[i-2]
return d... |
2c62bc72ba9e6de55f7f07e14c9c69baf479c65a | 6579a4af0ed9d9539a74f5a5052f86eb2ceb776c | porkilandia/Porkisoft | /Inventario/models.py | Python | py | 12,353 | no_license | from django.db import models
# Create your models here.
class Grupo(models.Model):
nombreGrupo = models.CharField(verbose_name='Nombre', max_length=20)
refrigerado = models.BooleanField(verbose_name = 'Refrigerado')
congelado = models.BooleanField(verbose_name = 'Congelado')
def __unicode__(self):
... |
70b76f92ba169e24c04cbe7caccd008fadf3fcb0 | 636b3b26b09fcc38b50ef0fc69cfee6253ea1557 | JorgeUPS/Phyton | /7_02_list-dicts.py | Python | py | 948 | no_license | # Create a list of the BRICS countries
country = [
"Brazil",
"Russia",
"India",
"China",
"South Africa"
]
"""Create a dictionary of BRICS capitals.
Note that South Africa has 3
capitals. Therefore, we embed a list inside
the dictionary.
"""
c... |
b4a2d738c000e9e9ca1e9ffa9ddd856457fe7015 | 1df1224a941566d1c42611dbeb04b62aebdc9d48 | Pramurta/Associative-Classification-Method-Based-on-rule-Pruning-for-Classification-of-Datasets | /CBA-master/cba_cb_m1.py | Python | py | 6,754 | no_license |
import cba_rg
from functools import cmp_to_key
import sys
import time
def is_satisfy(datacase, rule):
for item in rule.cond_set:
# print("item",item)
if datacase[item] != rule.cond_set[item]:
return None
if datacase[-1] == rule.class_label:
return True
else:
re... |
1f2f49639588c9be75031c0b3c0bdfbb23e09189 | ed12a5d90ba8e10114797f608f4457e15cf8cf3a | shivajreddy/TraderPy | /main.py | Python | py | 3,885 | permissive | # TraderPY Main File
#
# Written By Sam Gulinello
# MIT Licensed
#
# For More Information About This Project Go to
# https://github.com/SamGulinello/TraderPY
# Imports required for the program to work properly
from datetime import time, datetime, date
# Add this as the root directory on the PATH
# Sources said this ... |
e810a18616bb15196785a7f66e6eb5ecb0c9c410 | 595b47be6724e9c763585d9df00b21a78f7a2f5c | DweebsUnited/CodeMonkey | /YellowSummer/plotter.py | Python | py | 777 | permissive | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn.cluster import KMeans
data = open( "cols.csv", "r" )
xs = [ ]
ys = [ ]
zs = [ ]
for l in data.readlines( ):
cs = l.split( ',' )
cs = list( map( lambda c: int( c ), cs ) )
xs.append( cs[ 0 ] )
ys.a... |
bbaa2124eef32958045c2c88ea7916f5ab87a695 | 84ae03a5de2dac61642c1026ffc455c2c1a50dcf | watachan7/ToyBox | /Python_works/tkinter_code/painterz.py | Python | py | 8,151 | no_license | from tkinter import *
from PIL import Image
import os
os.chdir("C://Users//RGBK0025-1//Desktop//作業フォルダ//Gits//wltln_repo//ToyBox//Python_works//tkinter_code")
#----------------------------------------------------------------------
def filenameMaker(num):
return "%03d.png" % num
class MainWindow():
#------... |
ac7d554717ed008cc4b504e5b5cceee14c108475 | f03734d78239f23b08b0024e424d77f96ad1de6a | PengZiqiao/report_factory_3 | /query.py | Python | py | 2,099 | no_license | from winsunDB.query import Query, ZHUZHAI
from utils import Month
from winsunDB.model import MonthSale, MonthSold
from sqlalchemy.sql import func, label
import pandas as pd
class ReporterQuery(Query):
m = Month()
def month_index(self, period):
dates = list(self.m.before(i) for i in range(period))
... |
ccc33c62ae26155ff0fd6e9674df613a6efec5ce | 60ab1e8ced597358b7239b49399363896e6732c8 | Michael-E-Rose/Woolridge_IntroEconometrics_Solutions | /07-09.py | Python | py | 1,003 | permissive | """Python script for C9, Chapter 7 of Wooldridge: Intr. Economometrics"""
import pandas as pd
import statsmodels.formula.api as smf
import numpy as np
# Read in df
file = "./data/401ksubs.dta"
df = pd.read_stata(file)
print(df.head())
print(">>>>")
# i)
print("Fraction of families eligible for 401k:")
print(len(df[d... |
7be153ee1685fd35e23cfeefbb67ad06bfd7c35e | d294244475182ed2f3b2b2e3c8db955ab9edfb72 | Liyubov/ojo_daps_mirror | /ojd_daps/dqa/plots/s3_size_collected_weekly.py | Python | py | 2,485 | permissive | # +
"""
s3 size collected weekly
----------------
Total size of files in the 'most_recent_jobs' S3 bucket, grouped
by the "job posted" date in the main body of the HTML.
Note that the data is only sampled (see SAMPLE_RATIO) as
the data processing rate from S3 is too slow without e.g. Spark
"""
from ojd_daps.dqa.s3_... |
00a9efe894d48a455253404fbd29467a67615d6b | 51e9d6e9650f26f5c5a8bc691477329501a908ff | chenfeilong/pachong | /第二章:requests模块基础/06实战之药监总局相关数据爬取.py | Python | py | 1,012 | no_license | import requests
import json
url = 'http://125.35.6.84:81/xk/itownet/portalAction.do?method=getXkzsList'
url2 = 'http://125.35.6.84:81/xk/itownet/portalAction.do?method=getXkzsById'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/... |
21ce79488476211d4e811678d3dc37294b8ed272 | 8d5cc584c8b0ed18dd2f4f09991334b213d7874b | lichuminglcm/DI-engine | /ding/entry/application_entry.py | Python | py | 6,391 | permissive | from typing import Union, Optional, List, Any, Tuple
import pickle
import torch
from functools import partial
from ding.config import compile_config, read_config
from ding.worker import SampleSerialCollector, InteractionSerialEvaluator
from ding.envs import create_env_manager, get_vec_env_setting
from ding.policy impo... |
05a2c3c70e72196afe2b6c2b9b896d35aebc9fff | 6b126f913eb093ce060092a075be4c16c5390a5c | icaps15-CAP/downward-fixed-build | /translate/translate.py | Python | py | 28,145 | no_license | #! /usr/bin/env pypy
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
def python_version_supported():
major, minor = sys.version_info[:2]
return (major == 2 and minor >= 7) or (major, minor) >= (3, 2)
if not python_version_supported():
sys.exit("Error: Translator only supports Py... |
7337d37e54ac336979b2d5ef4e2f0d7723f40896 | 6159ab3080fb8709f1e1f8380e6c3394e9c8a672 | stevenna/django-DefectDojo | /dojo/tools/bundler_audit/parser.py | Python | py | 3,022 | permissive | __author__ = 'jaguasch'
import hashlib
from datetime import datetime
from dojo.models import Finding
class BundlerAuditParser(object):
def get_scan_types(self):
return ["Bundler-Audit Scan"]
def get_label_for_scan_types(self, scan_type):
return "Bundler-Audit Scan"
def get_description... |
c991bb1706c4d807892fdabd635f298c280ae17c | fc93e2fdc2fca2138e3d730a6cde9a543ed9f2e1 | jjjjmhao/Sprider | /抖音爬虫.py | Python | py | 2,515 | no_license | from selenium import webdriver
from lxml import etree
from selenium.webdriver.chrome.options import Options
import requests
import json
import time
class Douyin:
def page_num(self,max_cursor):
#网址后面的随机参数(我实在分析不出规律)
# 设置谷歌无界面浏览器
chrome_options = Options()
chrome_options.add_argument(... |
1eb4b57ac4c688b54352b2b5120a5b1348e0bb2a | c608440111003d5b911a7bb2ea9b470abd50761e | erjohns3/DoorBell | /monitor_server.py | Python | py | 2,629 | no_license | import os
import sys
import time
import logging
from watchdog.observers import Observer
from watchdog.events import LoggingEventHandler, FileSystemEventHandler
import subprocess
import datetime
the_path = "/home/pi/programming/python/doorbell_getter"
doorbell_git_path = os.path.join(the_path, "DoorBell")
os.chdir(door... |
97f863645b2e50edf9105b19260234a1a55fb5be | 1b178ca4fcd586f06c1a4c393f9f2b00eaf757ef | QualiSystems/cloudshell-orch-sandbox | /cloudshell-orch-core/cloudshell/workflow/helpers/resource_helpers.py | Python | py | 2,536 | permissive | def get_vm_custom_param(resource_info, param_name):
"""
:param ResourceInfo resource_info:
:param param_name:
:return:
"""
vm_detail = get_vm_details(resource_info)
for param in vm_detail.VmCustomParams:
if param.Name == param_name:
return param
return None
def ge... |
09fc4c446eafd7e9e0e2e7b54c78814cbe67a232 | 1541d123ba72e8b49406fb14c8d37be7d2e1623b | luhralive/python | /Drake-Z/0015/0015.py | Python | py | 866 | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''第 0015 题: 纯文本文件 city.txt为城市信息, 里面的内容(包括花括号)如下所示:
{
"1" : "上海",
"2" : "北京",
"3" : "成都"
}
请将上述内容写到 city.xls 文件中。'''
__author__ = 'Drake-Z'
import json
from collections import OrderedDict
from openpyxl import Workbook
def txt_to_xlsx(filename):
file = o... |
92edebf0974582198756ad0f1ecb3e69bfa3a9bf | 0afc4bc79c6b8e7767d06bb0778c6f763f9da197 | schoenja/old-university-code | /iiw3_act/part2.py | Python | py | 1,103 | permissive | import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize
volume_list = [1.5, 2.05, 2.5, 2.5, 0.75, 0.725, 0.75]
pressure_list = [33.25, 32.25, 30.25, 32.0, 43.0, 34.5, 33.5]
pressure_err = [0.25]*7
volume_err = [0.0125]*7
plt.figure(figsize=(8, 6), dpi=80)
plt1 = plt.subplot(1, 1, 1)
plt.grid(True)
p... |
c6b648d0c3999ef5f6b51c3d3c0e4b7f4936fd60 | 7411371966372098abae55aa51984e82b58790f9 | iignacjusz/cantera-jupyter | /demo/demo_TP.py | Python | py | 4,682 | no_license | """
Shock and Detonation Toolbox Demo Program
Explosion computation simulating constant temperature and pressure reaction.
This demo still uses an old, slow method of solving ODE systems in Python, with
a constant time-step. It is sufficiently fast for the purposes of the demo, but
for development of new ODE systems... |
e083db4798b9ea5847d33a7e3a23719e44e33d87 | 53add5819591e938c0b76084ca7faf77731c2009 | benchsci/rules_python_external | /src/namespace_pkgs.py | Python | py | 3,248 | permissive | import os
import sys
from src import wheel
from typing import Set
# See https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages
PKGUTIL_STYLE_NS_PKG_INIT_CONTENTS = (
"# __path__ manipulation added by rules_python_external to support namespace pkgs.\n"
"__path__ = _... |
e289d30ab30bb35041d687cbf04ecba1e2ce720f | 6712846fe282b403697f7ae3002da202f122b941 | vrgubbi/XlsxWriter | /xlsxwriter/test/comparison/test_image25.py | Python | py | 1,102 | permissive | ###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2014, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
ed2760a1f11ff8f5880d1f880974780d4dfd716c | 8ff93500277ff4dd0504b87e8c5881db2828d09d | Br3nda/notifications-api | /app/errors.py | Python | py | 3,915 | permissive | from flask import (
jsonify,
current_app,
json)
from sqlalchemy.exc import SQLAlchemyError, DataError
from sqlalchemy.orm.exc import NoResultFound
from marshmallow import ValidationError
from jsonschema import ValidationError as JsonSchemaValidationError
from app.authentication.auth import AuthError
class... |
3372038499645a381fcecda0ae058593e9a04fa7 | 8408b3b111027ee0f09990e9770258ead8092de2 | lifesailor/machine-learning-implementation-from-scratch | /1. A,B Testing(Frequentist and Bayesian)/Freq 1. t_test.py | Python | py | 433 | no_license | import numpy as np
from scipy import stats
# Data Generator
N = 10
a = np.random.randn(N) + 2
b = np.random.randn(N)
# Calculate t Statistics
var_a = a.var(ddof=1)
var_b = b.var(ddof=1)
s = np.sqrt((var_a + var_b) / 2)
t = (a.mean() - b.mean()) / (s * np.sqrt(2.0/N))
df = 2*N - 2
p = 1 - stats.t.cdf(t, ... |
861fba212defc743a19fad77dbf49b41973d52ae | cce1619c87435b673bd63d1f6433efacdf952b10 | asgamb/OpenConfig | /driver/ExampleDriverMH.py | Python | py | 9,271 | no_license | import string
from socket import socket, AF_INET, SOCK_STREAM
import time
from threading import *
import threading
import thread
import socket as sock
#Monitoring Socket: IP port of remote Netconf Agent
IP = "10.30.2.190"
PORT = 12346
ADS = (IP, PORT)
#monitoring period
PERIOD=5
#Local server socket for the configur... |
97fd6dff983d2f62c4a3b9f0e9a8670ce2b060a5 | b86958b887804857ac42dfdecf96da6e874c3381 | wanyuhuang/UQpy | /src/UQpy/Reliability.py | Python | py | 25,722 | permissive | # UQpy is distributed under the MIT license.
#
# Copyright (C) 2018 -- Michael D. Shields
#
# 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 th... |
b14852cb2bdb6baaf779c683aedc59db263c4e84 | ef5f4797932347287556a24be483e2d24dfb00e5 | igrztv/DB_TP | /api/forum.py | Python | py | 3,057 | no_license | from api.tools.entities import forums, posts, threads
from flask import Blueprint, request
from api.helpers import related_exists, choose_required, intersection, get_json
import json
module = Blueprint('forum', __name__, url_prefix='/db/api/forum')
@module.route("/create/", methods=["POST"])
def create():
conten... |
0a7e358c0b27c46b26aab6f78fde14a6c9664881 | 29cd0c758e30ae30bc082237b924d61ebf8dba25 | hobsond/Graphs | /projects/ancestor/ancestor.py | Python | py | 2,080 | no_license | test_ancestors = [(1, 3), (2, 3), (3, 6), (5, 6), (5, 7), (4, 5), (4, 8), (8, 9), (11, 8), (10, 1)]
from queue import Queue,LifoQueue
import random
import math
def ancestorGraph(ancestors):
child_Parent={}
for (i,j) in ancestors:
if j not in child_Parent:
child_Parent[j] = []
... |
5fddccd2fc52acac27f0e073237a71bbc722696b | 7ced0dc4ec42b5141e094207c292ab056ad8234d | whigg/subradar | /Classdef.py | Python | py | 2,453 | permissive | """Various Python classes"""
__author__ = 'Cyril Grima'
import numpy as np
from . import roughness, utils
NAN = float('nan')
class Signal(object):
"""Signal relationships"""
def __init__(self, wf=NAN, bw=NAN, th=0., bmw=NAN, h=NAN, **kwargs):
self.wf = wf # Signal central frequency [Hz]
s... |
28b9b3123fea64f443377b7f7452281acb3a4dac | c9a94d60a8d28c676bb0dd41cd412aff7b61715e | asrinutku/facerecognotion | /createdatset.py | Python | py | 1,635 | no_license | import cv2
import time
cam = cv2.VideoCapture(0, cv2.CAP_DSHOW)
""" internetten aldıgımız egitilmis seti programımıza ekliyoruz"""
cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
""" yuz tanımada ekrana cizecegimiz dikdortgenin sınırları icin bi degisken belirliyoruz"""
cizgisinirlari... |
cb2989f519a354c11b97ddaa924bb51f36723edb | 6d2a225ebe41acd824656b28a785459510cae8cb | fabuli/fabioPensePython2e | /capitulo3/ex_3_1.py | Python | py | 473 | no_license | #Exercício 3.1
# Escreva uma função chamada right_justify,
# que receba uma string chamada s como parâmetro
# e exiba a string com espaços suficientes à frente
# para que a última letra da string esteja na coluna 70 da tela:
def right_justify(txt):
espaco_branco = " " * 70
string_resultante = espaco_branco... |
18990ad4bf2aaca3c3997188ccfb190f775d6c2d | 3052a1a627c3630e4e1269565e9ee29dbac67252 | mindspore-ai/mindspore | /tests/st/tensor/test_adjoint.py | Python | py | 2,405 | permissive | # Copyright 2022 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... |
d26546cfc5456a9a5af94c7ed569c172bf56cce8 | 253e1b3a62458c3a8ced6e0b7f2888aa1158518a | lyj95618/crg2 | /scripts/crg.intersect_sv_vcfs.py | Python | py | 6,260 | permissive | import pandas as pd
from os import mkdir, path
from shutil import move
from pathlib import Path
from datetime import date
import sys
crg_path = snakemake.config["tools"]["crg"]
if "~" in crg_path:
crg_path = path.expanduser(crg_path)
sys.path.insert(0,crg_path)
from SVRecords import SVGrouper, SVAnnotator
def make_e... |
a302128a38e885ee147e0312ee0191a290db7516 | 88961364211fa4e33b32ebbc397936aa876d2d9a | haeena/omoikane | /nature_api_client/api/default_api.py | Python | py | 86,566 | no_license | # coding: utf-8
"""
Nature API
Read/Write Nature Remo # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from n... |
bd6193944e710c79461ec7497477f2d5078e7a43 | 80dced43274432e4a2f24d172a00c72a79b19e97 | AnguseZhang/Input_TI | /p38a_input/L2C/2C-3FZ_MD_NVT_rerun/set_2.py | Python | py | 741 | no_license | import os
dir = '/mnt/scratch/songlin3/run/p38a/L2C/MD_NVT_rerun/ti_one-step/2C_3FZ/'
filesdir = dir + 'files/'
temp_prodin = filesdir + 'temp_prod_2.in'
temp_pbs = filesdir + 'temp_2.pbs'
lambd = [ 0.00922, 0.04794, 0.11505, 0.20634, 0.31608, 0.43738, 0.56262, 0.68392, 0.79366, 0.88495, 0.95206, 0.99078]
for j in la... |
3b8c28d381cf3cfc4a73f9ab3e5e5fb814e78397 | 87079db759cbe700ca7f24b51a37fbfab38014dd | hellowolrds/book-1 | /ESBook/tests/log_test.py | Python | py | 1,278 | no_license | #coding=utf-8
"""日志测试模块,测试日志相关功能"""
from books.bookconfig import CONSOLE_LOGGER,ERROR_LOGGER
import time
def error_logger_test():
"""error logger 测试 输出error级别日志信息到日志文件并且输出到控制台。
删除多于指定保留个数的日志文件
日志信息写入当前目录下logs文件夹内"""
ERROR_LOGGER.error('error logger 测试')
time.sleep(65)
ERROR_LOGGER.error... |
6e8ef44dc49802ba822d84d8e6c0f0fa17792d53 | 2f99c0b87811b318da81de46e1e6dc61d5c620fc | kentnf/spvirome-website | /virome/views/pageDisplay.py | Python | py | 5,496 | no_license | #!/usr/bin/python
import os, sys
import os.path
import re
from django.conf import settings
from django.http import HttpResponse
from django.http import JsonResponse
from django.shortcuts import render
currentdir = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(currentdir)
import loadData
... |
a3fb664154cf3afeb8bce4e9f572f4d660a3cc38 | ccfe7a3454d47a137acb6e51a494b2b12918c2de | grantjames/adventofcode | /2020/10/part2.py | Python | py | 948 | no_license | import re
f = open("input.txt", "r")
input = f.readlines()
f.close()
# convert lines to ints
input.append(0)
input = sorted(list(map(int, input)))
device_joltage = max(input) + 3
input.append(device_joltage)
cache = {}
def ways_from_index(i):
total = 0
if i in cache:
return cache[i]
if i == l... |
f9ee35a03f49c2b166d1f91580d183cfa3a20b83 | cff98711bcf5c3c2e95a8d1a14498f3d16e0e997 | dvbfuns/TTS-related | /text_number_process.py | Python | py | 7,739 | no_license | from pypinyin import pinyin, lazy_pinyin, Style
import os
import warnings
from decimal import Decimal
path = "/Users/mayanke/Documents/test_pinyin/"
def number_trans(value, capital=True, prefix=False, classical=None):
if not isinstance(value, (Decimal, str, int)):
msg = '''
由于浮点数精度问题,请考虑使用字符串,或... |
d94f30c7f723961152b178df86d81a15460dc88f | 98d9ee5b7856772e6562c94049cb03890304d9b4 | s-andromeda/BFS-2 | /Problem3.py | Python | py | 1,118 | no_license |
"""
Name : Shahreen Shahjahan Psyche
Time : O(M * N)
Space : O(N)
This code passed all the test cases in Leetcode
"""
from typing import List
# Definition for Employee.
class Employee:
def __init__(self, id: int, importance: int, subordinates: List[int]):
self.id = id
self.impo... |
2ab22168abdbdb31c2605c3669fe38c3253f6199 | 5cb2440d31413dff55de84a51832159884573308 | ramode/backend | /utils.py | Python | py | 740 | permissive |
def return_as_json(handler):
"""
Это декоратор, который приводит вывод функции в HTTP JSON ответ.
"""
from aiohttp import web
import datetime
async def middleware_handler(request):
res = await handler(request)
if type(res) == web.Response:
return res
def date_to_isoformat(item):
print(item)
... |
bfdfdb88312f97b267f4e710058776f6bc472745 | 1862478ce00fd944d20dcec2930684f31a843928 | betfund/betfund-event-broker | /betfund_event_broker/tasks/mongo/find.py | Python | py | 1,542 | permissive | """MongoDB Find Task Module."""
import os
from betfund_logger import CloudLogger
from betfund_event_broker.tasks.mongo import MongoTask
logger = CloudLogger(
log_group="betfund-event-broker",
log_stream="mongo-find-events",
aws_access_key=os.environ.get("AWS_ACCESS_KEY"),
aws_secret_key=os.environ.ge... |
0dfa6e17b68c05e72edca57db76ef78d9e6894e0 | 3c73097a7e9b7ef989fa11e8b1023fd15e0451e0 | grahamgilbert/sal | /server/migrations/0034_auto_20160219_1125.py | Python | py | 497 | permissive | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('server', '0033_auto_20160217_1050'),
]
operations = [
migrations.AlterUniqueTogether(
name='pendingappleupdate',... |
d75ae1aa54e27c545271e748b8fcb9bdf766866e | a9111c419e0e0b7088186b54cf912aea573b35fe | ledell/h2o | /py/testdir_multi_jvm/test_KMeans2_sphere5_inits.py | Python | py | 9,000 | permissive | import unittest, time, sys, random, math
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_kmeans, h2o_import as h2i
from operator import itemgetter
# want named tuples
import collections
# a truly uniform sphere
# http://stackoverflow.com/questions/5408276/python-uniform-spherical-distribution
# While... |
a6c70b41ffc60489178914dfd001b3cc9fa36bcd | a253ae679e3cea8f85d483e5066f632208e947b5 | offsecin/Bug-Bounty-tools | /manual_github_dorks.py | Python | py | 763 | no_license | from requests.utils import requote_uri
import sys
url="https://github.com/search?q="
filename='dorks.txt'
try:
company=sys.argv[1]
except:
print("usage python3 github_dorks.py TARGET")
sys.exit()
common_dorks=["aws_keys",".bashrc","jira_creds","aws_keys","*.swp",".bashrc","ssh_keys","password","secret",... |
5d625cab7307cea78305821e233ac5f9ab9f1733 | 82f50ee879f528a3a9abc3e7a0081fc756230509 | Pronomuos/Digital-culture-course | /lab2/main.py | Python | py | 3,982 | no_license | # coding=utf-8
import re
import codecs
class TypoCorrect:
def __init__(self):
pass
text = ""
words = {}
dict = {}
typoes_and_correct = {}
@classmethod
def read_text(cls, ifile='brain333.txt'):
with codecs.open(ifile, "r", "1251") as f:
cls.text = f.read().lowe... |
8f3f06458e74694e92b5445745646e57d4e38cb4 | 6800d908e4b7f5c99df047841667470f73cf6f0e | cwallac/SoftwareDesign | /HW6/GameTest2.py | Python | py | 5,413 | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 8 10:46:23 2014
@author: cwallace
"""
import pygame
from pygame.locals import *
import random
import math
import time
GameLost = 0
class DoodleJumpModel:
def __init__(self):
self.platforms = []
for num in range(1,4):
for plat in range(1,... |
528f9241ac0b61334d37d73d1541551b703213c8 | bc7504ebb3a7806c280fd700a0bbb3143196173a | herisulistiyanto/simple_crud | /manage.py | Python | py | 339 | no_license | import os
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from src.app import create_app, db
env_name = os.getenv('FLASK_ENV')
app = create_app(env_name)
migrate = Migrate(app=app, db=db)
manager = Manager(app=app)
manager.add_command('db', MigrateCommand)
if __name__ == '__main__'... |
eb529a539147e44f5d12e0a93c28b689bc805f38 | 366bc1b7c55958118d9f0d6f469d244f8a6f5bb3 | winnerineast/v8 | /tools/dev/gm.py | Python | py | 13,554 | permissive | #!/usr/bin/env python
# Copyright 2017 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""\
Convenience wrapper for compiling V8 with gn/ninja and running tests.
Sets up build output directories if they don't exist.
Produ... |
ac473b5d240cb2710bb43920f60e8e2494bd04cf | fd2fb36d0cf189183a6a0ef647db0027e848a99a | Stevenzzz1996/MLLCV | /Computer_Vision/face_ID/centernet+arcface/arcface/models/metrics.py | Python | py | 6,242 | no_license | from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
import math
'''
loss设定:arcface
'''
class ArcMarginProduct(nn.Module):
r"""Implement of large margin arc distance: :
Args:
in_f... |
02abaee4b019b114a7b2a53f2705eb5c7f8be348 | 7437db106099fff2835b0423a52462f24c0165b5 | cylmemory/CodeTraining | /Leetcode/006--914. X of a Kind in a Deck of Cards/Solution.py | Python | py | 1,485 | no_license | # -*- coding:utf-8 -*-
# X of a Kind in a Deck of Cards
# 题目大意:
# 一副写着整数的牌,当返回True时,即可以把这副牌分为1组或者多组,没每组的牌数量X>=2:
# 1.每组牌数量为X
# 2.每组牌的数量都相同
# 例1:
# 输入:[1,2,3,4,4,3,2,1]
# 输出:true
# 说明:可能的分区[1,1],[2,2],[3,3],[4,4]
# 例2:
# 输入:[1,1,1,2,2,2,3,3]
# 输出:false
# 说明:没有可能的分区。
# 例3:
# 输入:[1]
# 输出:false
# 说明:没有可能的分区。
# 例4:
... |
a0ba4bda723d5ca908922a15c470ed4fb0534e77 | 5b423ae3bb993753ed7b19e02d032f1674925844 | dev-fennek/spconv | /spconv/__init__.py | Python | py | 3,653 | permissive | # Copyright 2019 Yan Yan
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
32aa474e36d0284667d1b1fd1b728db79c9665c6 | afc8f6253cb24cc885115b943753805b146dbc07 | hironaga-1/cps-code | /webcam.py | Python | py | 1,714 | no_license | import cv2
import glob
import random
# https://qiita.com/iwatake2222/items/b8c442a9ec0406883950
# http://project12513.blog-fps.com/raspberrypi%E9%96%8B%E7%99%BA/%E3%83%A9%E3%82%BA%E3%83%91%E3%82%A4%E3%81%A7opencv%E3%81%AE%E5%87%A6%E7%90%86%E3%82%92%E9%80%9F%E3%81%8F%E3%81%99%E3%82%8B
# https://ja.laptopwide.com/260598... |
10eccc19e4c215f33fe70b4ddc739b3a0c7ea851 | 45b534edbf027baa5cb8a3b0752a7af40bfdc319 | GivemeHam/CodingTest | /src/baekjoon/bfs/1389_2.py | Python | py | 978 | no_license | from collections import deque
N, M = map(int, input().split())
rel = [[0]*N for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
rel[a-1][b-1] = 1
rel[b-1][a-1] = 1
visits = []
for i in range(N):
visit = [-1] * N
queue = deque([i])
weight = deque([0])
visit[i] = 0
w... |
3795de19392ed60409e28c690dd9b7520645f3ff | 9f26b081fb1046a9ef74dc95ad280f1afea6457f | romanlop/Python-Samples | /json_writer.py | Python | py | 551 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 22 18:54:39 2018
@author: Ruman
Construir fichero JSON
"""
import json
contenidoJSON={'alumno1':{'nombre':'roman', 'matriculado':True, 'asignaturas':34, 'ID': None},
'alumno2':{'nombre':'juan', 'matriculado':False, 'asignaturas':... |
7a78c67aa11b2ffb053b7d1a405c10a12ddf78b7 | 4435cef34bd8420fa9114219b7ea8ecd776feca9 | sdenk31/doctest | /conf.py | Python | py | 5,331 | no_license | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
7390de01dd1a58342e14f0f8f066bcd902251a50 | edf90e2c15d64ab5b4f817c59fc842e9f2f2ae3d | Jaycolas/CS231n | /assignment1/cs231n/classifiers/linear_classifier.py | Python | py | 5,628 | no_license | import numpy as np
from cs231n.classifiers.linear_svm import *
from cs231n.classifiers.softmax import *
class LinearClassifier(object):
def __init__(self):
self.W = None
def train(self, X, y, learning_rate=1e-3, reg=1e-5, num_iters=100,
batch_size=200, verbose=False):
"""
Train this linea... |
c9f0b883245cf1a395e2f85f0ec47c625e0d5565 | 64dd2a963038861f2c866aa07b5e38f92bf3b182 | CrowdStrike/falconpy | /src/falconpy/_auth_object/_falcon_interface.py | Python | py | 21,436 | permissive | """API Interface base class.
This file contains the definition of the standard base class that provides
necessary functionality to authenticate to the CrowdStrike Falcon OAuth2 API.
_______ __ _______ __ __ __
| _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----.
|. 1___... |
47f847c7e6156ad0cad8506818dada671921e003 | 87831cf1b5231e3a219795229590ae85f9fc2112 | standardgalactic/CellularAutomata | /Square.py | Python | py | 389 | no_license | BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
class Square():
margin = 2
width = 10
def __init__(self, left, top, state):
self.left=left
self.top=top
self.state=state
def getState(self):
return self.state
def getPos(self):
return (self.left, self.top)
de... |
1f3947a4ad8b46a0266aae68001b411c88c9b671 | 24dcdb58c9bda0afee7b26073fdcd5a8e8787b73 | KJH-ComputerScience/missionPython | /listings/listing8-9.py | Python | py | 28,257 | no_license | # Escape - A Python Adventure
# by Sean McManus / www.sean.co.uk
# Art by Rafael Pimenta
# Typed in by PUT YOUR NAME HERE
import time, random, math
###############
## VARIABLES ##
###############
WIDTH = 800 #window size
HEIGHT = 800
#PLAYER variables
PLAYER_NAME = "Sean" # change this to your name!
FRIEND1_NAME =... |
c37a225761088bde02209c4341be77054317a509 | c232632cc850658956a5473c1b26f95e9ce4771e | cisco-en-programmability/dnacentersdk | /tests/models/validators/v2_2_1/jsd_a352f6280e445075b3ea7cbf868c2d94.py | Python | py | 11,509 | permissive | # -*- coding: utf-8 -*-
"""Cisco DNA Center duplicateSensorTestTemplate data model.
Copyright (c) 2019-2021 Cisco Systems.
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, inc... |
0a27ca1e0cc8524c80a61ff4776bc289c55a7ea3 | 70fb8a92efe8e2f2f0d73913ae2dea6580cf365d | Algorithm-P0/meanjung | /2020/1try/4_dfsbfs/16234.py | Python | py | 1,198 | no_license | import sys
from collections import deque
N, L, R = map(int, sys.stdin.readline().split())
populate = []
for _ in range(N):
populate.append(list(map(int, sys.stdin.readline().split())))
dy = [-1,1,0,0]
dx = [0,0,-1,1]
cnt = 0
def bfs(y, x):
q = deque()
q.append([y, x])
temp = []
temp.append([y, x])
... |
beb0575e921200c99be3b39c52dab8f7734d53ab | ac4d190dd742e2fd6aae641559b3f07f3f689607 | beloved23/unica2 | /flight/views.py | Python | py | 46,028 | no_license | from __future__ import unicode_literals
import collections
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse_lazy, reverse
from django.views.generic import ListView, DetailView, UpdateView, CreateView, DeleteView
from for... |
b10b3378f11c8a7fb008cad2579e3a4ac68e1650 | 7e78749b534a8415159274448761e57a2dbe6125 | taraskl/studentsdb | /students/modelss.py | Python | py | 1,783 | no_license | # -*- coding: utf-8 -*-
from django.db import models
# Create your models here.
class Student(models.Model):
"""Student Model"""
class Meta(object):
verbose_name = u"Студент"
verbose_name_plural = u"Студенти"
last_name = models.CharField(
max_length=256,
blank=False,
verbose_name=u"Прізвище")
first... |
36f0d0b49622fdf0b1c9c249b114c0341601c3ba | a546a0f680dba2c1a0f8e64de0eaa70c2f78e15e | pendgaft/scrapcode | /origDL_nodes.py | Python | py | 3,552 | no_license | #!/usr/bin/python
"""
download_logs.py
@author Brian Sanderson
@date 1/2007
Downloads boot nodes into slice and generates node lists.
"""
import sys
import xmlrpclib
import sets
remove_nbnodes = '-r' in sys.argv
no_file_writes = '-n' in sys.argv
api_server = xmlrpclib.Server('https://www.planet-lab.org/PLCAPI/')
... |
f438dd78eba06f856cf897737098c3bf6bee67b7 | f75773e3b74f75da43a02185504fb8ebdf951419 | JoshuaOndieki/joshua-ondieki-bootcamp-17 | /Day 1/tdd/loan_calculator.py | Python | py | 285 | permissive | #!/usr/bin/env python
# encoding: utf-8
def loan_calculator(amount, rate, time):
if amount<0:
return "Invalid amount!"
if rate>100:
return "Invalid rate!"
if time>12:
return "Invalid Number of months!"
return amount + (amount*(rate/100)*time)
|
3d1c0a69713ded70e8d603964d73dfd9f135f608 | fd7833a27c622dea39e344a378830f025c256e4e | DmitriiDenisov/MADE_CV | /seminar7-detection2/retinanet/model.py | Python | py | 12,837 | no_license | import torch.nn as nn
import torch
import math
import torch.utils.model_zoo as model_zoo
from torchvision.ops import nms
from retinanet.utils import BasicBlock, Bottleneck, BBoxTransform, ClipBoxes
from retinanet.anchors import Anchors
from retinanet import losses
model_urls = {
'resnet18': 'https://download.pytor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.