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 |
|---|---|---|---|---|---|---|---|---|
36c4f6a41d28844ea4e985971ad06b12db3f55f7 | 53dfb32be3a0d80e2be418138d7682db64c9a6dc | abhishak3/qiskit-experiments | /test/fake_backend.py | Python | py | 1,875 | permissive | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
1ba109bad027f069221cbd28dfdf854e41d5c998 | 55ff56a29bb165f85360c28aa99a5ad51ec2b127 | wmpauli/nipype | /nipype/interfaces/semtools/segmentation/tests/test_auto_BRAINSMultiSTAPLE.py | Python | py | 1,536 | permissive | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..specialized import BRAINSMultiSTAPLE
def test_BRAINSMultiSTAPLE_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefault=True,
),
inp... |
50eb121d5ef14cf3d68e077b72093052e1c2b8f1 | 22575e92fc955566e61c6603538dec0f2ec5b2ec | Luciferseva/wifi_simtool | /Ui_SerialPort.py | Python | py | 11,216 | no_license | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'E:\AllPrj\PyQt5prj\MySerialPort_universal\SerialPort.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setu... |
ac91f4e242479bb573cf8cc0db21e7221ad58313 | 2d02161ed10fbfd2981857ed2800908025699874 | bluesad/let | /src/util/snmp_test.py | Python | py | 2,220 | no_license | # -*- coding: utf-8 -*-
'''
Created on 2012-9-9
@author: zongzong
'''
# Notification Originator Application (TRAP)
from pysnmp.carrier.asynsock.dispatch import AsynsockDispatcher
from pysnmp.carrier.asynsock.dgram import udp
from pyasn1.codec.ber import encoder
from pysnmp.proto import api
from pysnmp.entity.rfc3413... |
1436a0002dbb270c68eabe8df0a793968ce50117 | a7ef54f0f1c8a6c51eb1b83cb78dd1998b0a6cee | ryannetwork/ml_platform_dags | /projects/taxi_load/modules/merge_raw_green.py | Python | py | 881 | no_license | # the spark_setup file gets loaded in from py-files in spark submit
from spark_setup import get_spark
spark = get_spark()
spark = spark \
.appName("Merge Green Schemas") \
.enableHiveSupport() \
.getOrCreate()
spark.conf.set("spark.sql.shuffle.partitions", spark.sparkContext.defaultParallelism*4)
green_t... |
f03474d9604604f20b8ba7873414fe4d33d598f2 | 81b8d4b325b928122946871024859c5d6fff8444 | Maxx100/site | /data/users.py | Python | py | 1,320 | no_license | import sqlalchemy
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from flask_wtf import FlaskForm
from wtforms import PasswordField, StringField, TextAreaField, SubmitField
from wtforms.fields.html5 import EmailField
from wtforms.validators import DataRequired... |
3a5fc3e23928c847cb214c0a9d384045e121007c | 8ab412912edfc966b97950ef935c1b8d40349e9d | dfava/mmgo | /src/mmgo/tests/chan_send_size2_block.py | Python | py | 1,808 | permissive | # Copyright (C) 2017 Daniel Fava. All Rights Reserved.
import re
import myunittest
class Common(myunittest.TestCase):
def test_k(self):
self.assertEqual(len(self.config.goroutines), 1)
m = re.match("channel \( .* \) <- 6", self.config.goroutines[0].k)
self.assertNotEqual(m, None)
pass
def test_c_f... |
fab3e93c2c81272d8ff3820ef0ca693fce7f270e | 3c111be4320d9f80ffffafe5bc38cd6e655a4b5a | iman-kamkar/Data-Science-Salary-Prediction | /gs.py | Python | py | 346 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 16 14:10:01 2020
@author: iman
"""
import glassdoor_scraper as gs
import pandas as pd
path = "/Volumes/Macintosh Data/Data Science/my_projects/ds_salary_project/chromedriver"
df = gs.get_jobs('data scientist', 1000, False, path, 10)
df.to_csv('gla... |
5d74f0f02be43132f0d5e8f8a1a1859d1a187510 | dbf364c10b32382b9e05de7906e0bde90eed5d1e | shubhamingle/Data-Structures | /Sorting Algorithms/quick_sort.py | Python | py | 533 | no_license | def Partition(a, start, end):
pivot = a[end]
pIndex = start
for i in range(start, end):
if a[i] <= pivot:
temp = a[i]
a[i] = a[pIndex]
a[pIndex] = temp
pIndex += 1
a[end] = a[pIndex]
a[pIndex] = pivot
return pIndex
def QuickSort(a, start, ... |
2c43d8738ecb12ae697b687f35e7c16796bcf027 | 277cff1111ee2350d25a20d48e164c1059fbd162 | Specky9coder/Python_Practice_1 | /Examples.py | Python | py | 2,180 | no_license | gpa = float(input('What Is Your Grade Point Average:'))
lowest_grade = float(input('What Is Your Lowest Grade: '))
if gpa >= .85 and lowest_grade >= .70:
honour_roll = True
else:
honour_roll = False
#
#
#
if honour_roll:
print('You Made It To The Honour Roll')
#
from array import array
s = array()
s.append(... |
992fb9ca86c59d3b069998773cefc105dabc8559 | 50961f4947c7e3a6f2e8e6cf01d0db457f40ee27 | kimgaejin/TypicalImpressionOfProductAnalyzer | /ReviewAnalyzer/ReviewDivider.py | Python | py | 27,034 | no_license | import FileManager
import DataBaseManager
import DictionaryBuilder
import WordSimilarity
import NLP
import os
import datetime
import math
import main
baseDir = ''
sourceName = ''
productDic = {}
productSimilarDic = {}
similarInsertQuery = []
similarUpdateQuery = []
insertQuery = []
updateQuery = []
def SortProductLi... |
4132f7ab0bcf505ec93cd7567f3f1d10bc96f68e | 3db8b4d378a56733d4f3933326767390a2fd2add | mwilliamson/funk | /test/test_util.py | Python | py | 1,148 | permissive | from precisely import assert_that, equal_to
from funk.util import arguments_str
from funk.util import function_call_str
from funk.util import method_call_str
from funk.util import function_call_str_multiple_lines
def test_arguments_str_shows_positional_and_keyword_arguments():
result = arguments_str((1, "two"), {... |
94f3d325b41679ea337f9cf1d6578156fa63689f | 3c6edd952c3e9d418be3815760eb7f5f68900b8f | UnsignedByte/discow | /utils/datautils.py | Python | py | 1,966 | permissive | # @Author: Edmund Lam <edl>
# @Date: 15:30:46, 04-Nov-2018
# @Filename: fileutils.py
# @Last modified by: edl
# @Last modified time: 15:42:27, 07-Nov-2018
import os
import pickle
from shutil import copyfile
from discow.handlers import bot_data
def load_data_file(file):
res = {}
if os.path.isfile('Data/'+f... |
b122487d244365e108e6311edb3e0a938c1c36f4 | 00b265dc858fd58e82b569e5c09f491184c0714a | paynej5504/PythonFinal | /flask_auth_app/project/auth.py | Python | py | 2,436 | no_license | #import statements
from flask import Blueprint, render_template, redirect, url_for, request, flash
from werkzeug.security import generate_password_hash, check_password_hash
from .models import User
from flask_login import login_user, logout_user, login_required
from . import db
auth = Blueprint('auth', __name__)
... |
7b018c2e70b30db40646b999b7df61afd876e651 | 3b64d4ebe7e80985b361477cca3eef3404890c09 | seqwalt/ME532_project | /code/DataPreprocess.py | Python | py | 2,990 | no_license | import numpy as np
# ------------------------------------ #
# --- Data Preprocessing Functions --- #
# ------------------------------------ #
# --- One-hot encoding --- #
# This function turns categorical features of n categories, into n features,
# where each new feature is a '1' if the data point is in that category... |
256f18654c6af4477da923a883782fe629d4cd13 | 777422184a5fb0d3533b3f07e754f6b019c7735b | danache/hmr | /src/data_loader.py | Python | py | 12,117 | no_license | """
Data loader with data augmentation.
Only used for training.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from os.path import join
from glob import glob
import tensorflow as tf
from .tf_smpl.batch_lbs import batch_rodrigues
from .util import data... |
5e9d32cb10e7c546c22a044bc88f4321746e3117 | beb6c4de7f8ec98fa4a6e1c9beae4ad0da476182 | tensorflow/tfx | /tfx/v1/dsl/standard_annotations.py | Python | py | 1,237 | permissive | # Copyright 2023 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
da952e9fab1ab6707408129f55e324cab94a49a0 | a40dc4790dfea912ee999c0449c6016b4445ef70 | Josh-Woodcock/wagtail-apps | /events/migrations/0010_remove_eventpage_intro.py | Python | py | 391 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-22 14:11
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0009_eventpage_intro'),
]
operations = [
migrations.RemoveField(
... |
f3b9224f64e3280e93ada91acb91aede60ca4160 | 6106b32ba344d4cb544d5e2196fc87c443c0b355 | pierluigiderosa/retevista | /dash_aziende/urls.py | Python | py | 4,741 | no_license | from django.conf.urls import url
from .views import dashboard_fields, form_campi, add_profile, CampiGeoJson, form_analisi, dashboard_analisi, \
CampoUpdateView, AnalisiUpdateView, form_coltura, \
CampoDeleteView, ColtivazioneDeleteView, AnalisiDeleteView, dashboard_main, get_data_charts, \
dash_operazioni_... |
1ea3b00e3825ac21616b0907a6b18510f1e5f210 | 0cc46706d551ba4d14866302e0a925f4bc032466 | ChetanGorantla/virtualbank | /Card.py | Python | py | 760 | no_license | import Balance
def card():
cardType = str(input("What type of card would you like to get?\n"
"1. Credit Card\n"
"2. Debit Card\n"))
if cardType == "1":
creditCardAmount = int(input("How much money would you like to place in your Credit Card?"))
... |
8b890c75af3077b693e9d18833308d4f018bcaf7 | ca524f67a4f85f387c3143d4cc3a9d55fa675c1c | yuhengy/NetworkLab | /lab13/mininet/nat_topo3.py | Python | py | 3,718 | no_license | #!/usr/bin/python
import time
from mininet.node import OVSBridge
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.cli import CLI
class NATTopo(Topo):
def build(self):
h1 = self.addHost('h1')
h2 = self.addHost('h2')
s1 = self.addSwitch('s1')
n1 = self.addH... |
28b6819cfdf70e2a19af60eb35186af3d9f928ac | 3b6fb89fbc9243774f6965d63e349a17ca1efb61 | tatsuya4649/dcolor | /tests/test_name.py | Python | py | 1,507 | permissive | import pytest
from dcolor.name import *
from dcolor.where import *
@pytest.fixture(scope="function", autouse=False)
def name_init():
name = Name(
color="red",
where=ColorWhere.CHARACTER,
)
yield name
def test_init_string():
result = Name()
assert isinstance(result, str)
assert... |
2c988af0dba03605e1725bd23f015c17b7c6e3f6 | 560301447f7d9ae7ae40b4511e95ed7f50e092d0 | Albertoerto96/python | /modulo02/program4.py | Python | py | 364 | no_license | #Formateando cadenas
numero = 10/3
print("Resultado: " + str(numero))
print("Resultado: {n:1.2f}".format(n=numero))
variable = input("Dime tu nombre: ")
print("Dices que tu nombre es " + variable + ".")
print(f"Dices que tu nombre es {variable}.")
print("Dices que tu nombre es {}.".format(variable))
print("Dices q... |
2923b5d476832655889e22dc972d4f93b2c66a74 | 4494595889a0d20a16ce7367741788b5bbf567d8 | amir9ume/word_prediction | /word_prediction.py | Python | py | 5,349 | no_license | import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader, random_split, RandomSampler, SequentialSampler
from torch.utils.data import TensorDataset
from transformers import AdamW
from transformers import get_linear_schedule_with_warmup
import pandas as pd
import os
import logging
from data... |
efc6b101068c2e68f008dd1bed9659082068362e | 6a5d5c7de659a9cee7830e5aba6d31993e42858a | englishthomas/magma-1 | /symphony/cli/pyinventory/graphql/move_location_mutation.py | Python | py | 2,030 | permissive | #!/usr/bin/env python3
# @generated AUTOGENERATED file. Do not Change!
from dataclasses import dataclass
from datetime import datetime
from gql.gql.datetime_utils import DATETIME_FIELD
from gql.gql.graphql_client import GraphqlClient
from gql.gql.client import OperationException
from gql.gql.reporter import FailedOper... |
fe817d2db3dcb46ba4f49f0e0094a0d322dd0719 | 4c8497da2600abe1c8a995751a14e400fc350f2d | rsmahabir/calfire-wildfires | /setup.py | Python | py | 1,190 | permissive | import os
from setuptools import setup
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
return f.read()
setup(
name='calfire-wildfires',
version='0.0.2',
description="Download wildfires data from CalFire",
long_description=read('README.rst'),
author='L... |
f75ecd97a6db1d0c894bfc6870dfa796add264dd | 43f9497a15d607d4eb5110a69de68d4d87c0084e | hhe0/Leetcode | /Easy/0900-0999/0944/python/Solution.py | Python | py | 551 | no_license | class Solution:
def minDeletionSize(self, A):
"""
:type A: List[str]
:rtype: int
"""
res = 0
for i in range(0, len(A[0])):
flag = True
for j in range(0, len(A) - 1):
if A[j][i] > A[j+1][i]:
flag = False
... |
8dbdca87d3aa5b77c0b8b3f75addb2ba05a5a09b | a7e784b3e66a00e5c7f63d48d904bd889982376a | zhaoww/python-notes | /study/test06.py | Python | py | 734 | no_license | # -*-coding:utf-8-*-
# list生成式 [expr for iter_var in iterable if cond_expr]
list0 = [x * x for x in (range(1, 10)) if x % 2 == 0]
print(list0)
# 生成器[] -> ()
list1 = (x * x for x in (range(1, 10)) if x % 2 == 0)
print(list1)
for x in list1:
print(x, end = ' ')
# yield
# 函数是顺序执行,遇到 return 语句或者最后一行函数语句就返回。而变成 genera... |
c4174bfe77d3ab10900a6c3bf8d092bd67eb9403 | 40c881448c7be7c52adb6d8a1349c095e7032ecb | Honghe/happy-1024 | /main.py | Python | py | 611 | permissive | import curses
from time import sleep
from pyfiglet import figlet_format
def main():
# init curses
stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(True)
happy_1024 = 'Happy 1024!'
for x in range(len(happy_1024)):
greeting = happy_1024[:x + 1]
greetin... |
ec056db144ff1902fe6205d3e3a79c8ad8cf8f37 | 37693676216e540ecb83a6727a48aaa737e25749 | a2821952/RRC_2 | /rrc_example_package/scripts/sim_dice_example_with_gym.py | Python | py | 899 | permissive | #!/usr/bin/env python3
"""Demo on how to run the simulation using the Gym environment
This demo creates a SimRearrangeDiceEnv environment and runs one episode using
a dummy policy.
"""
from rrc_example_package import rearrange_dice_env
from rrc_example_package.example import PointAtDieGoalPositionsPolicy
import ipdb
... |
c3a54ad7b52d4c083a1ea387515d7caa9fd611da | a66ebae86c4eb3a1b028d97631a574438bd39984 | qTipTip/kattis-problems | /zero-one-sequences/main.py | Python | py | 1,948 | no_license | import sys
def mod_mult(a, b):
# These are mathematically not correct, should be (a % num * b % num) % num, however
# it made no difference in the Kattis test-cases.
return (a * b) % 1000000007
def mod_add(a, b):
# These are mathematically not correct, should be (a % num + b % num) % num, however
... |
d7255f25497cef26e09165d52499c86c48c26eb4 | 8c1aa26ba9a384c88225cd04b64deb796bbbcec1 | tahmidefaz/insights-host-inventory | /app/xjoin.py | Python | py | 2,004 | no_license | from logging import getLogger
from flask import abort
from flask import current_app
from flask import request
from requests import post
from app import IDENTITY_HEADER
from app import inventory_config
from app import REQUEST_ID_HEADER
from app import UNKNOWN_REQUEST_ID_VALUE
from app.culling import staleness_to_condi... |
0365d415fc286e6580c945416a9e1c24dc5984ec | 2dbace9e9e182b620a159bc2e150148ed6b4b510 | JonathanAndradeSilva/mmclassification | /mmcls/models/backbones/__init__.py | Python | py | 642 | permissive | from .alexnet import AlexNet
from .lenet import LeNet5
from .mobilenet_v2 import MobileNetV2
from .mobilenet_v3 import MobileNetv3
from .regnet import RegNet
from .resnest import ResNeSt
from .resnet import ResNet, ResNetV1d
from .resnet_cifar import ResNet_CIFAR
from .resnext import ResNeXt
from .seresnet import SERes... |
42b80afef7a59694cc29d16381c1a13e82429e99 | 370625dcdffa33303951523d59f839ffc8b1d07c | BloodAxe/pytorch-toolbelt | /pytorch_toolbelt/datasets/segmentation.py | Python | py | 4,746 | permissive | from functools import partial
from typing import Optional, List, Callable
import albumentations as A
import cv2
import numpy as np
from skimage.measure import block_reduce
from torch.utils.data import Dataset
from .common import (
read_image_rgb,
INPUT_IMAGE_KEY,
INPUT_IMAGE_ID_KEY,
INPUT_INDEX_KEY,
... |
c019e0724afa88736b54f8361c0613731adb4339 | 7b4219500969e00bb07e7281b4eb9aac4113dffe | ilaydaucar/AB_2018 | /election/migrations/0002_question.py | Python | py | 1,251 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-01-28 11:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('election', '0001_initial'),
]
operations = [
... |
1c7e05d30686d92f69835848b43fec8de2d5441b | 254944b7a29b8c8835ece2bf6effd92e8670a2ff | 6turm/hw05_final | /posts/migrations/0001_initial.py | Python | py | 848 | no_license | # Generated by Django 2.2.9 on 2020-06-25 21:01
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
9fef1168f097e7792c2785358ae8132a782cfe6e | 2aadd884c8407f41adef82616dd22339d4b471ab | deepraj88/excel_to_latex | /excel_to_latex.py | Python | py | 11,714 | no_license | import pandas as pd
import math
import sys
import os
from pandas import ExcelWriter
from pandas import ExcelFile
def program(arg1, arg2):
#Output File
f = open(arg1+"_"+arg2, "w")
print("Name of Excelsheet = ",arg1)
print("Name of the sheet = ",arg2)
print("Name of output file= ",arg1+"_"+arg2)
#Input File
d... |
aed3c09e6c5942d3ee30db4e123db7204f75eb9d | 545bd207f5f365a6053ec20b6d8eb05b9a1b2281 | Ing-Josef-Klotzner/python | /_promotion0.py | Python | py | 690 | no_license | #!/usr/bin/python3
from sys import stdin
def isValid (boxes, truck, n, m, mid):
i, j = 0, 0
df = mid // 2 + mid % 2
while (i < n and j < m):
if (boxes [i] > truck [j]): return False
i += df
j += 1
if (i < n and j >= m): return False
return True
def main ():
read = stdin.readline
n, m = map (int, r... |
22b8ca0f0140c2bf136ce4b55fa8f36e0d644f04 | c1caab2a238fbf0cc2d58ff5ff1520b15bd1d1c5 | jhadevansh0809/carzone-gitproject | /contacts/migrations/0001_initial.py | Python | py | 1,222 | no_license | # Generated by Django 3.0.7 on 2021-06-24 15:38
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Contact',
fields=[
('id', m... |
929d5af15ee897bc71a4f2f6b842d297753dd9d1 | 8bd901de7b2c65c85f2cc4efb06edcd32ed59bec | biinari/wxsql | /app/tree/schema_tree.py | Python | py | 3,686 | no_license | #!/usr/bin/env python
"""
Tree of database structure.
Tree structure will contain the following nested levels of items:
Database:
Table:
Columns:
Indexes:
"""
import wx
from ..db.mysql import DB
from database import Database
class SchemaTree(wx.TreeCtrl):
""" Tree of database... |
0a47b77f80f782ed5d44e93381da006ee287e5db | 304c0f2b255851a38617cd1c54566056c118ed7e | Narasimha-MIVC/MIVC-Automation | /automation-pbx/lib/PPhoneInterface/__init__.py | Python | py | 48,744 | no_license | import os
from robot.libraries.BuiltIn import BuiltIn
from robot.libraries.Collections import Collections
from robot.api import logger
# from robot.libraries.Telnet import Telnet
import telnetlib
import psutil
import shutil
import subprocess
import time
import re
import sys
from sys import platform as _platform
import ... |
2bbe963fd81a47fd48c7bfd977a25f8e0f99e819 | 1593db1ee5580615213dee269ac41d53d288d833 | rainyuyi/sorting-algorithms | /test.py | Python | py | 322 | no_license | import Sort
A = [1,7,5,8,3,5,3,4,2]
print('A = ',A)
result1 = Sort.InsertionSort(A)
print('by Insertition-Sort:',result1)
result2 = Sort.MergeSort(A)
print('by Merge-Sort:',result2)
result3 = Sort.QuickSort(A,0,len(A)-1)
print('by Quick-Sort:',result3)
result4 = Sort.bucketSort(A)
print('by Bucket-Sort:',result4)
... |
9b786cfd2ba81b7e78912d0affcb5e08a6616ee6 | db7397fa21bc8a93825ec3bc88510b3b335401d5 | RohitPr/PythonProjects | /31.Automated_Weather_Report/venv/Lib/site-packages/twilio/rest/api/v2010/account/usage/record/all_time.py | Python | py | 28,501 | no_license | # coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resou... |
f99057889d1f6fafdaa4c1ab67a34c811d8fb2d7 | 336685e18868afcd762055c0c7885c409cb798fa | sellpizza/soprize11-doyouknowclub | /index_to_name.py | Python | py | 741 | permissive | import os
import glob
import json
if __name__ == "__main__":
cwd = os.getcwd()
down_dir = os.path.join(cwd, "downloads")
result_dir = os.path.join(cwd, "result")
info_dir = os.path.join(result_dir, "video_url")
if not os.path.exists(info_dir):
os.mkdir(info_dir)
video_list = glob.g... |
cf3d7aec16093938e807a863ee5877d4fedcc5ec | ffc4134ec32cb1c793732739afbe19d81582454f | qiBerry/Sunmobile | /Client/rightSecurity.py | Python | py | 260 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
ip = '192.168.0.106'
port = 1080
message = '1/3/120'
sock = socket.socket()
sock.connect((ip, port))
sock.send(message.encode('utf-8'))
data = sock.recv(32)
sock.close()
print(data) |
3d7d9aae5d3afbe974bdc98448541ebfd3a1abca | 4c2e1f55ae67802d0cac68d64b5fcef5c48d23a0 | szenergy/szenergy-utility-programs | /drivemode_sound/src/scripts/play_sound_sub.py | Python | py | 841 | no_license | #!/usr/bin/env python3
import rospy
import rospkg
import autoware_msgs.msg as aw_msgs
from playsound import playsound
buf = 0
def subscriber():
rospy.Subscriber("/vehicle_status", aw_msgs.VehicleStatus, callback_fuction)
rospy.spin()
def callback_fuction(message):
global buf
if (1 - message.drivemod... |
78499bf48879d3884c5414c010fdaf0cf8308f06 | 384eadeaccb9aab31a3749a551794745a7f5d13a | Athena1004/python_na | /venv/Scripts/nana/threading03.py | Python | py | 848 | no_license | import time
import threading
def loop1(in1):
print("start loop 1 at:",time.ctime())
print("我是参数",in1)
time.sleep(4)
print("end loop 1 at:", time.ctime())
def loop2(in1,in2):
print("start loop 2 at:",time.ctime())
print("我是参数", in1,"和参数 ", in2)
time.sleep(2)
print("end loop 2 at:", time... |
afb6e42f21f91dd7500eac549d13afcf2aa1be47 | 237a028f5956f60cf6f60fbd3503c366f926091f | lauer3912/chromium.src | /tools/json_schema_compiler/h_generator.py | Python | py | 15,184 | permissive | # Copyright (c) 2012 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.
from code import Code
from model import PropertyType
import cpp_util
import schema_util
class HGenerator(object):
def __init__(self, type_generator, c... |
cabd0c16df0fcec9597f43d011980f5b7b326590 | 386670fb9dba822c34ba0978e6f1f6cee0c944fc | Kcheung42/Django_DBMS | /django_apps/dbms/migrations/0001_initial.py | Python | py | 1,610 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-04 04:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ItemM... |
2c44f7a34f1736cb573e3d164bb31ddcd3d5cf0d | 3460eb1e8a04cb3c54bb40d14a98573887306330 | nikolaosdionelis/NeuralNetworksNNs | /newToUse11June2020/train_resume_img_cp.py | Python | py | 182,421 | no_license | # Aim: Zero first term
# and also zero second term
## Store Best
#utils.save_checkpoint(
# {'state_dict': genGen.state_dict(), 'optimizer_state_dict': optimizerGen.state_dict(),
# 'args': args},
# os.path.join(args.save, '000mmainNikNik99MaaiiinMaaiiinBeBe'), args.nepochs)
## Save 7, 600
#utils.save_checkpo... |
12c35e28d81bec0a76c02b6917ca273e8deb7da8 | 21428638665e67f902b52edd07977be85237892c | aiedward/just_another_seq2seq | /chatbot/train.py | Python | py | 5,089 | no_license | """
对SequenceToSequence模型进行基本的参数组合测试
"""
import sys
import random
import pickle
import numpy as np
import tensorflow as tf
from tqdm import tqdm
sys.path.append('..')
def test(bidirectional, cell_type, depth,
attention_type, use_residual, use_dropout, time_major, hidden_units):
"""测试不同参数在生成的假数据上的运行结果"... |
008567e8dfe9a8d6fc2fc3340afb846f280fc980 | dbe9104e7ad9d73afc48011a70a99f3e1d223f09 | study1994/MxDjango-django-study | /MxDjango/apps/course/migrations/0003_auto_20170819_0921.py | Python | py | 524 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2017-08-19 09:21
from __future__ import unicode_literals
import DjangoUeditor.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('course', '0002_auto_20170819_0914'),
]
operations = [
mi... |
651161512d720e101cb870d48686711cc2202328 | 19bbf0a08457b05d18940e22d97d3a7649a56274 | alipay/alipay-sdk-python-all | /alipay/aop/api/domain/AlipayOpenServicemarketOrderUpgradeModel.py | Python | py | 2,013 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayOpenServicemarketOrderUpgradeModel(object):
def __init__(self):
self._commodity_order_id = None
self._product_codes = None
@property
def commodity_order_id(self):
... |
f39f2f5522cc8948a7406a88568ba5593f5fd0ed | 97880fca41c01ab420550e3b3007ec73624b16cc | lowks/django_auth | /auth_backend/tests/unit/test_managers.py | Python | py | 1,904 | no_license | from dateutil import parser
from django.test import TestCase
import responses
from . import mocks
from ...models import KagisoUser
class KagisoUserTest(TestCase):
@responses.activate
def test_create_user(self):
email = 'test@email.com'
first_name = 'Fred'
last_name = 'Smith'
... |
c5c57184c9d01b8ee959b06cbabd7f8e5c839571 | 39a45de3d0bc35a7dcbe7db527b1489595fdc75e | PatrikGergely/beating-blackjack-with-reinforcement-learning | /bbwrl/utils/logger.py | Python | py | 2,050 | permissive | # MIT License
#
# Copyright (c) 2021 Patrik Gergely
#
# 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, merg... |
fb7804971260c2133b824b53fc09e0b092a749e1 | 8b36578d1ed3016ed03810b46cfab2d961c0dc79 | qianqianzhu/mutphy | /case_study/arduino_lab/group_01/run_test.py | Python | py | 3,822 | no_license | import subprocess,os,signal
import serial,io,time
import pytest
import string
from operator import add
#-----------------------------
# test helper functions
#-----------------------------
def send_image(image_path):
# source ros file
output = subprocess.check_output('source /home/qianqianzhu/image_transport_w... |
2e4bcaa1d8deea59e3b05329c7a9272a72ad132d | 1af3e25833d74494f8fb5bc443d9281bd88257d9 | judahrand/dataclasses-avroschema | /tests/serialization/test_primitive_types_serialization.py | Python | py | 3,827 | permissive | from dataclasses import dataclass
from dataclasses_avroschema import AvroModel
def test_primitive_types(user_dataclass):
data = {"name": "juan", "age": 20, "has_pets": True, "money": 100.0, "encoded": b"hola"}
data_json = {"name": "juan", "age": 20, "has_pets": True, "money": 100.0, "encoded": "hola"}
... |
67d1e346c33978f14fe278b136515ca0315a8ea0 | 2b410136eba101ecd37b585e926eb0868166baa9 | hemangdtu/FunProblems | /pr4.py | Python | py | 371 | no_license | #A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
#Find the largest palindrome made from the product of two n-digit numbers where n is a nnumber entered by user.
def sys
calc(n):
#TODO
if __name__ == '__main__':
#Accept user i... |
f52fe02a459904aec1b666425e6497a6822c108f | 954999a15d8d69ea19c884a8d02296e6c9b6cf5d | Manngold/baekjoon-practice | /Python/1759_CreatePassword.py | Python | py | 652 | no_license | from collections import deque
from itertools import combinations
l, c = map(int, input().split())
c = deque(sorted(list(map(str, input().split()))))
aeiou = "aeiou"
answers = [];
def checker(word):
a= 0
b= 0
for i in word:
if i in aeiou:
a += 1
else:
b += 1
if a >=1 and b >=2:
return ... |
166e9924ff3245b938593138d43c8621b00c48ba | 0cdda30d69c7e9dc1b2721ac20443fd8c2209908 | mateor/betarepo | /src/python/betarepo/datastructures/linear/concrete/lists/linked_list.py | Python | py | 2,308 | permissive | # coding=utf-8
# The MIT License (MIT)
# Copyright (c) 2016 mateor
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from betarepo.datastructures.linear.abstract.list import List, ListException
class LinkedList(ob... |
1226909a445b51ee550d4b033589743b6657326f | 8eb27f2f2fc9be834eebc96baf37ffe1dc121207 | extrakun/tgc8-django-bookreviews | /books/models.py | Python | py | 2,074 | no_license | from django.db import models
from django.contrib.auth.models import User
from cloudinary.models import CloudinaryField
# Create your models here.
# we want to have a Book table inside our database
class Genre(models.Model):
title = models.CharField(blank=False, max_length=255)
def __str__(self):
re... |
77bc634351912b4fbff47165d0a438960d61ee80 | ff9c9650e57a3bc247e8f899c437a64375133888 | llw33556/devops | /devops8/apps/utils/ansible_api.py | Python | py | 10,301 | no_license | from ansible import constants
from collections import namedtuple
from ansible.parsing.dataloader import DataLoader
from ansible.playbook.play import Play
from ansible.executor.task_queue_manager import TaskQueueManager
from ansible.executor.playbook_executor import PlaybookExecutor
from ansible.plugins.callback import ... |
5b06a69ffc6f3096db321d7dc65780f25cc35018 | f4e329c68b48f40e7d283fca798e98bc202271f4 | Kamakepar2029/bot-net | /server.py | Python | py | 1,331 | no_license | import socket
from colorama import Fore, Back, Style
import sys
import os
import time
import socket
import random
#Code Time
from datetime import datetime
sock = socket.socket()
sock.bind(('', 12456))
print('Server port: 12456')
sock.listen(10000)
while True:
conn, addr = sock.accept()
print(Fore.GREEN + ' [!... |
1a98870693c175af7ebcb8f8ea518839d3c5c309 | 55bcaec626fbe428c699a3f209ed237cf3ed15a7 | akamoroz/nginx-amplify-agent | /test/unit/agent/objects/nginx/config/parser.py | Python | py | 18,477 | permissive | # -*- coding: utf-8 -*-
import os
from hamcrest import *
from amplify.agent.objects.nginx.config.parser import NginxConfigParser, IGNORED_DIRECTIVES
from test.base import BaseTestCase
__author__ = "Mike Belov"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__credits__ = ["Mike Belov", "Andrei Belov... |
178e07ae02cd9033199208330fa1a4e97b5c6b7a | 74051b3f768b85628db09715f4ebf2598a250b3e | cms-sw/cmssw | /Geometry/HGCalGeometry/test/python/testHGCalWaferInFileOrientation_cfg.py | Python | py | 1,291 | permissive | import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
process = cms.Process('PROD',Phase2C17I13M9)
process.load('Configuration.Geometry.GeometryExtended2026D86Reco_cff')
process.load("SimGeneral.HepPDTESSource.pdt_cfi")
process.load('Geometry.HGCalGeometry.hgcalW... |
044bd68f9e6bddcde08ea1eb2dd12df0b4ea03d7 | 141ddead04e20e50733b36b65779d2079b88c6dc | jbsauvan/H2Taus-Studies | /FakeRate/Uncertainties/Closures/storeSampleNormalizations.py | Python | py | 761 | no_license | from CMGTools.H2TauTau.proto.plotter.Samples import createSampleLists
from CMGTools.H2TauTau.proto.plotter.HistCreator import setSumWeights
import pickle
analysis_dir = '/afs/cern.ch/work/j/jsauvan/public/HTauTau/Trees/mt/151215/'
tree_prod_name = 'H2TauTauTreeProducerTauMu'
data_dir = analysis_dir
samples_mc, samples... |
c699f106b9b02180b4da1a63dff6f5490ede6555 | f343d859c9a58a15e9652949aca124ac76a55517 | donhatkha/CS2225.CH1501 | /Repo/venv/Lib/site-packages/caffe2/python/operator_test/square_root_divide_op_test.py | Python | py | 2,285 | no_license |
from caffe2.python import core
from functools import partial
from hypothesis import given
from hypothesis import strategies as st
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
import math
import numpy as np
def _data_and_scale... |
3f01cbac524b737063d6576af345858d959afe38 | beef8e75b5c4845d889eacfa627540c662c949dc | Yangqing/tensorflow | /tensorflow/python/ops/standard_ops.py | Python | py | 2,043 | permissive | # pylint: disable=wildcard-import,unused-import
"""Import names of Tensor Flow standard Ops."""
# Imports the following modules so that @RegisterGradient get executed.
from tensorflow.python.ops import array_grad
from tensorflow.python.ops import data_flow_grad
from tensorflow.python.ops import math_grad
from tensorfl... |
1fe9d6e52105b211b56551ea8198bcb9aced873b | 0228b249556031c20b75752c2f670a34abd69470 | chengzhao41/FSND-P4-Design-A-Game | /api.py | Python | py | 16,699 | no_license | # -*- coding: utf-8 -*-`
"""api.py - Create and configure the Game API exposing the resources.
This can also contain game logic. For more complex games it would be wise to
move game logic to another file. Ideally the API will be simple, concerned
primarily with communication to/from the API's users."""
import endpoint... |
75b05275e60f7ef7538ac7b964260ca4b55d147a | 9b4a6799269d094a58858cc0cd2a021920654c7c | vinsonlaiono/hoopfinderV4 | /apps/hoopfinder/migrations/0036_followers_user_id.py | Python | py | 493 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-04 00:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hoopfinder', '0035_remove_followers_user'),
]
operations = [
migrations.Ad... |
7b3a37cd82d653b3c8cd2128f967427564ac3ecb | 5d3d68f40a91c76e40ab2ef9772d1a6ec5527d2e | fdavidcunha/my-first-blog | /mysite/settings.py | Python | py | 2,756 | no_license | """
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.8.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths... |
e1d6bdaf94aacbc26316a6336ea8aa69616a291f | 53c77f548e18388b0b759c0853d92c33958c0720 | weirdname404/courses | /algorithms/divide_and_conquer/segments.py | Python | py | 5,487 | permissive | # python3
import sys
import time
# O(nlogn)
def count_intersections(segments, points):
print(segments, points)
if len(points) < 2:
counter = 0
# O(n)
for segment in segments:
start, end = segment
if start <= points[0] <= end:
counter += 1
... |
8ee31065601ebeca41f19fe6b4daa4a029d0328d | 2594c63067799adb66e44085c16ce4dc4512b784 | probablytom/dekkers_lego_sim | /domain_model/Organisation.py | Python | py | 1,547 | no_license | from domain_model.Roles import *
class Organisation(object):
def __init__(self):
# Set up the organisation's constituent parts
self.customer = Customer()
self.sales = Sales()
self.production_planning = ProductionPlanning()
self.goods_receipts = GoodsReceipts()
self.... |
e12fe61cb084fbe560b3bdf515de38b968462f1e | c9ea42c3333df6dc97ca66bec5fe65a54e463fa2 | MegaYEye/PA_tmp | /GMRF_1D_linUpdate.py | Python | py | 2,456 | no_license | # GMRF 1D to GF comparision
import numpy as np
import matplotlib.pyplot as pl
import time
def kernel(a, b): # kernel for GF, note that GMRF is based on Matern kernel
dist = 0.7
sqdist = np.sum(a ** 2, 1).reshape(-1, 1) + np.sum(b ** 2, 1) - 2 * np.dot(a, b.T)
return np.exp(-.5 * (1 / dist) * sqdist)
#... |
85a97e2dba3c12da1c0132cadb15e147daf4dbf2 | f2604a621178fd6db1547ca74be4a2724d231f19 | elthran/ant-wars | /app/models/colonies.py | Python | py | 2,926 | no_license | from .templates import db, GameState
from .ants import Ant, QueenAnt, SoldierAnt
import random
class Colony(GameState):
"""A 'player' in the game."""
world_id = db.Column(db.Integer, db.ForeignKey('world.id'), nullable=False)
"""Which world the colony belongs to."""
user_id = db.Column(db.Integer, d... |
0fc4af821c257ad2799eac163dda0f708ce2b4a2 | 3dd114c5489605b349b8c471e26e3884fd533078 | Gamain/PyCode | /100Exps/exp39.py | Python | py | 622 | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
题目:有一个已经排好序的数组。现输入一个数,要求按原来的规律将它插入数组中。
'''
l=[1,2,3,4,6,7,8,9]
s= int(raw_input("input:"))
for i in xrange(0,len(l)-1):
if l[i]>s and l[i+1]>s:
continue
if l[i]<s and l[i+1]<s:
continue
l.insert(i+1,s)
break
else:
if l[-1]>l[0]: ... |
b773a655b946e15eb4f2233d750a1be416b51912 | 8fd61f57854e567da67717bd716673cd822736be | anhaidgroup/py_entitymatching | /py_entitymatching/debugmatcher/debug_gui_decisiontree_matcher.py | Python | py | 6,863 | permissive | from collections import OrderedDict
import logging
import six
import pandas as pd
import py_entitymatching as em
from py_entitymatching.evaluation.evaluation import eval_matches
from py_entitymatching import DTMatcher
from py_entitymatching.debugmatcher.debug_gui_utils import _get_code_vis, _get_metric,\
_get_da... |
c648594ac7c21819e13b76b4497b05304e80fd42 | d8cea88c69d9a1487f23f3bc63e0c445b57b34ad | utlis/100nlp | /2016/shu/ch2/e10.py | Python | py | 327 | no_license | #! /usr/bin/env python
# coding: utf-8
# 10.py
# 2016-05-22
#
def lineCount(path):
file = open(path)
lines = 0
for line in file:
lines += 1
file.close()
return lines
if __name__ == '__main__':
print lineCount('hightemp.txt')
# wc -l hightemp.txt
# 行数ではなく、改行数を数える
|
522a1d6139dac618a40e710c287d8d568120eae4 | db76615523d2cd1bc8df7eba257f2df847b2f29e | chenpota/python | /https-client/use-http.client/main.py | Python | py | 823 | permissive | #!/usr/bin/env python3
import http.client
import json
import socket
conn = http.client.HTTPSConnection(host='httpbin.org', port=443)
try:
conn.request('GET', '/get?show_env=1')
except socket.gaierror as e:
print(e)
exit(1)
httpRsp = conn.getresponse()
rspHeader = httpRsp.msg
rspContent = httpRsp.read()... |
c439ba4e9fcd0b34a74fc6060cad5784a68a5b93 | f605a8a476c2ff172704bfce71cd47c6191f5a4b | DiegoResolvit/nlp_project | /text_analysis.py | Python | py | 2,719 | no_license | from __future__ import print_function
from nltk import tokenize
import nltk, string, nltk.data, json
from nltk.stem import *
from nltk.stem.snowball import SnowballStemmer
stemmer = SnowballStemmer("english")
#para no tener que correrlo por afuera
nltk.download('punkt')
#párrafo que tengo que trabajar
sentence = """... |
b89833b5e65aa5728b895cd1d3de0b747fc78980 | 285b61c10b8e5945131147d300289a41dbc58d8a | saeidmoha/regression | /finance_regression.py | Python | py | 3,988 | no_license | #!/usr/bin/python
"""
Starter code for the regression mini-project.
Loads up/formats a modified version of the dataset
(why modified? we've removed some trouble points
that you'll find yourself in the outliers mini-project).
Draws a little scatterplot of the training/testing data
You fi... |
16083db87cced80849a5845fbdd01875b0f8e85c | cfac11c05724410e181f2176a327ce1ba989fd09 | Aasthaengg/IBMdataset | /Python_codes/p03281/s383012410.py | Python | py | 368 | no_license | # -*- coding: utf-8 -*-
def main():
N = int(input())
ans = 0
for i in range(1, N+1):
if i % 2 == 1:
count = 0
for j in range(1, i+1):
if i % j == 0:
count +=1
if count == 8:
ans += 1
pr... |
9c40755dce3b4438b28f0fff6f0df668a45b8d9f | 07add4e2d0ed32605cab28500181a9c2107e372e | rafaelperazzo/programacao-web | /moodledata/vpl_data/94/usersdata/202/56120/submittedfiles/mediaLista.py | Python | py | 372 | no_license | # -*- coding: utf-8 -*-
n=int(input('quantidade de valores:'))
lista=[]
for i in range(0,n,1):
l=float(input('valores:'))
lista.append(l)
def media(lista):
soma=0
for i in range(0,len(lista),1):
soma=soma+lista[i]
media=soma/len(lista)
return(media)
print('%.2f'%lista[0])
print('%.2f'%li... |
f03df4142472f34d5447ec29c79cde94eb92a39f | 152fa89f421720baeedc314d3c35033fe2d1fbb7 | dharamk/daas | /Server/host_list.py | Python | py | 1,474 | no_license | #!/bin/python3
"""
A function for Manager to get all hosts names/ports etc.
Returns:
List of HostAgent objects
"""
GET_AGENT_LIST_METHOD = 1 # static list
class Agent:
def __init__(self, agent_id, url=None, address=None, port=None):
if not agent_id:
raise ValueError
self.agent_id = a... |
e10bdb736d4c9d24dff696e685d3aaae2280dc99 | d2174b840e3df09202c1f03e6f5861fcf0297e92 | jieuhyl/Dash | /social_dash/Dash_social_tot_v2.py | Python | py | 19,214 | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 16 13:35:52 2018
@author: Jie.Hu
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 10 16:40:48 2018
@author: Jie.Hu
"""
import plotly
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_table_experiments a... |
648fa4c4b362d458c722ebde745cfb15663f8d87 | b1ea9adea7ec067eac2b94269370fa6960adb1ef | aka-andi/chatta | /main.py | Python | py | 3,075 | no_license | import nltk
from nltk.stem.lancaster import LancasterStemmer
stemmer = LancasterStemmer()
import numpy as np
import tflearn
import tensorflow
import random
import json
import pickle # load lists into pickle file for subsequent training executions
with open("intents.json") as file:
data = json.load(file)
try:
... |
e7bbfd4fc65c0d10267bce0cf2c74fd23c57506f | c051398500cf3365b1fd0d62a0ce130f80d1f9bf | unabl4/codility | /distinct/distinct.py | Python | py | 298 | no_license | # you can write to stdout for debugging purposes, e.g.
# print "this is a debug message"
def solution(A):
# write your code in Python 2.7
elements = {}
# O(n)
for i in range(len(A)):
elements[A[i]] = True
return len(elements) # number of keys
|
dc9a099695fbb2a23cd38f0d9ea9db522349ca54 | 651787b9986b7b0c070b531341a915d9eafd2a70 | isabella232/LinuxPatchExtension | /src/core/src/service_interfaces/TelemetryWriter.py | Python | py | 6,220 | permissive | # Copyright 2020 Microsoft Corporation
#
# 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... |
bd8f67c6364dfcb4e632d14c7d16dee83144fe74 | 71b6ac6f7f1021e4249e33c9800dbfd216e61729 | Akhier/Python3-Libtcod-Tutorial | /loader_functions/initialize_new_game.py | Python | py | 3,283 | no_license | import libtcodpy as libtcod
from components.equipment import Equipment
from components.equippable import Equippable
from components.fighter import Fighter
from components.inventory import Inventory
from components.level import Level
from entity import Entity
from equipment_slots import EquipmentSlots
from game_mess... |
86cc837a34bbb441a1aa7abbd926fd4e4195d0ab | b2628d9613cc7d8bd383c453cbc9e8344918d303 | mjocen/django_practices | /myproject/boards/views.py | Python | py | 355 | no_license | from django.shortcuts import render, get_object_or_404
from .models import Board
# Create your views here.
def home(request):
boards = Board.objects.all()
return render(request, 'home.html', {'boards': boards})
def board_topics(request, pk):
board = get_object_or_404(Board, pk=pk)
return render(reques... |
e5f9a66a9f07d40fb80c8fdcbf4268b77c953650 | 84cf46c4dfb4d87e437e94188deeb4fe23c46e05 | soylentdeen/Graffity | /src/DisturbanceFiles/disturbTTM.py | Python | py | 417 | permissive | import scipy
import numpy
import matplotlib.pyplot as pyplot
import pyfits
steps = numpy.linspace(-0.4, 0.4, 301)
subsample = 50
disturb = []
for step in steps:
frame = numpy.zeros(2)
frame[0] = step
for i in range(subsample*2):
disturb.append(frame)
disturb = numpy.array(disturb, dtype=numpy.f... |
050d328fcb09980ef3b761c930614499ddf5d845 | 07b4324db0e4ab847e1576698bdecd5edcdfc703 | pythonthings/spyder | /spyder/plugins/editor/widgets/tests/test_editor.py | Python | py | 30,392 | permissive | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
"""
Tests for editor.py
"""
# Standard library imports
import os
import os.path as osp
from sys import platform
try:
from unittest.mock import Mock, MagicMock
except ImportError:
from mock impor... |
0a1cc676359363264d2a64bdcdb727b825cbc286 | 88b93cb225c5820a286a3c961bababb0cff82243 | Abdelhz/da_python_p4_v2 | /app_files/services_chess.py | Python | py | 2,624 | no_license | def sorting_list_score(list_of_players):
list_players_sorted_score = sorted(list_of_players,
key=lambda player:
(player.score, player.ranking))
list_players_sorted_score.reverse()
return list_players_sorted_score
def cre... |
4102efaa267ed14c310276418679942d411f51b7 | 23b510a8c6dd5231ff569958ff063c5a02f4070d | T-head-Semi/csi-nn2 | /tests/python_ref/depthwise_convolution_relu_nchw.py | Python | py | 4,013 | permissive | #!/usr/bin/python
#-*- coding:utf-8 -*-
import sys
import struct
import numpy as np
from torch import tensor
from torch.nn import functional as fn
def depthwise_convolution_relu_f32():
para = []
# init the input data and parameters
batch = int(np.random.randint(1, high=4, size=1))
in_size_x = ... |
1e385d62b0e86988ec110f64db3cdfcee6e09ebd | dc29ab25b5dfb337bacf798d83ba8c9130f4fdd8 | bentodd1/governmentDataCrawler | /models.py | Python | py | 1,222 | no_license | from datetime import datetime
from config import db, ma
class Person(db.Model):
__tablename__ = "person"
person_id = db.Column(db.Integer, primary_key=True)
lname = db.Column(db.String(32))
fname = db.Column(db.String(32))
timestamp = db.Column(
db.DateTime, default=datetime.utcnow, onupda... |
fab6108e3122105b8f9de49b8f058d30e21fa97a | 810973f1fc712918018b3425927cec9eac6effbf | J11235/python_data_analysis | /numpy.py | Python | py | 2,909 | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 9 21:20:27 2017
@author: ranjing
"""
import numpy as np
#生成一个数组
data=np.array(
[[1,2,3],
[2,3,4],
[3,4,5]])
#维一些基本方法
data.shape
data.dtype
#创建ndarray
data1=[1,2,3,4.1] #这是一个列表
###列表的基本操作
data1.append(5)
data1.pop()
data1[2:]
d... |
bc386a8441771ac3f904c187957f2392ccc5d719 | b2a3128f31fd33ed78118088c63f8c6854887a70 | zealpatel1990/3gpp_tagger | /apps/3gg_processor_app.py | Python | py | 1,106 | no_license | from information_extraction.pre_process_data import pre_process_file
from information_extraction.tagging_automater import AutoTagProcessor
from services.document_service import DocumentService
from services.settings_service import SettingService
def download_settings():
# download the project settings for compari... |
be3092e7eb59accea7fe84105a06bcf40b6fc3c4 | b4c1a015d5b8941759dce60dd29801626c892a2e | keredson/distributed-issue-tracker | /setup.py | Python | py | 573 | no_license | #!/usr/bin/env python
from distutils.core import setup
setup(name='distributed-issue-tracker',
version='0.1',
description='Distributed Issue Tracker',
author='Derek Anderson',
author_email='public@kered.org',
url='https://github.com/keredson/distributed-issue-tracker',
packages=['d... |
8893585a8336b37a9f11ff893903955e92927196 | 3220da51018309b4fecbb218d0b1757f8ec24d04 | superfish9/pocmap | /script/resin/resin_crackpass.py | Python | py | 2,253 | no_license | #coding:utf-8
import urllib2
from t import T
class P(T):
def __init__(self):
T.__init__(self)
def verify(self,head='',context='',ip='',port='8080',productname={},keywords='',hackinfo=''):
timeout=3
target_url = 'http://'+ip+':'+port
result = {}
result['result']=Fals... |
32bd2d9f009e985bc91fbee6861d125e1c9dc4d1 | 839069c0c1a9f591f1fc6c30398554e217a22bbd | nvianiltr/Character-Recognition | /training.py | Python | py | 4,726 | no_license | # This is the file to train CNN using EMNIST dataset.
# Run this file first if you haven't had any model in your computer.
from keras.layers import MaxPooling2D, Convolution2D, Dropout, Dense, Flatten
from keras.models import Sequential, save_model
from keras.utils import np_utils
from scipy.io import loadmat
import p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.