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 |
|---|---|---|---|---|---|---|---|---|
c7c521038d5295a98310aee53b5355fd9a4bd6d5 | ec52ce268ba2292c287eed6785ee8ca5acc62f0c | MinhVuong2000/Practising | /QuestionsWithMatrixInterview/diagonalMatrix.py | Python | py | 593 | no_license | def diagonalMatrix(matrix):
r = len(matrix)
c = len(matrix[0])
for i in range (r):
for j in range(0,r):
if i-j<0 or j>=c:
continue
print(matrix[i-j][j], end=' ')
print('\n')
for j in range(1,c):
for i in range(r-1, -1,-1):
if j+... |
f42011992b44066dc0ffb37feb766e362d82620b | c0c5aa9183adb985412a1858438ff176c10a5f57 | wenh06/facenet | /src/freeze_graph.py | Python | py | 4,922 | permissive | """Imports a model metagraph and checkpoint file, converts the variables to constants
and exports the model as a graphdef protobuf
"""
# MIT License
#
# Copyright (c) 2016 David Sandberg
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation fi... |
7b066244ef1c1880a2d99ffe20a802d653f33c32 | 1934099298492dead2dfff218980a04d676b6c88 | dustincys/p-scnaclonal | /pSCNAClonal/test/geweke.py | Python | py | 589 | no_license | '''
Created on 2012-09-18
@author: Andrew Roth
'''
from __future__ import division
from math import sqrt
def compare_trace(trace_1, trace_2, g):
g_1 = [g(x) for x in trace_1]
g_2 = [g(x) for x in trace_2]
mean_1 = mean(g_1)
mean_2 = mean(g_2)
sigma_1 = variance(g_1)
sigma_2 = variance(g_2)... |
eed7a2376c40b6ae4657e0fb5a6e4d419b058b00 | 9d600abcfade62936b71b7117e9de148605e7a3f | FelixOfficial/adanet | /adanet/core/estimator.py | Python | py | 79,453 | permissive | """An AdaNet estimator implementation in Tensorflow using a single graph.
Copyright 2018 The AdaNet Authors. 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
https://www.ap... |
5127a913a213422bb4a3136c5facd24d0190e5f6 | f05b99b33f3c45337b674f1f5386207415ba83ec | TarasBeshlei/Algorithm_labs | /untitled10/wedd.py | Python | py | 1,653 | no_license | couples = dict()
passed = []
list_of_tribes=[]
result=[]
number_of_possible_pairs=0
def addDictList(values):
couples.setdefault(int(values[0]), [])
if int(values[0]) in couples.keys():
couples[int(values[0])].append(int(values[1]))
else:
couples[int(values[0])] = int(values[1])
with open (... |
8d063c350c2089e93a920d2c968f9572134b8c95 | e6cb21e4a4bdb700029e285d623e1aac85199886 | vanzhiganov/vmmanager | /compute/vmxml.py | Python | py | 1,422 | no_license | from abc import ABCMeta, abstractmethod
import xml.dom.minidom
from image.imagemanager import ImageManager
class AbsXML(object):
__metaclass__ = ABCMeta
@abstractmethod
def _get_xml_tpl(self):pass
def render(self, argv):
xml_tpl = self._get_xml_tpl()
if not xml_tpl:
raise ... |
2b9a557ab1ba07247fe919934736ccced272a2df | d0e69489e77e4442c3f4086769d5ece80ac93532 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2944/60621/249546.py | Python | py | 306 | no_license | a=input()
sign=a[0]
stack=[]
i=0;flag=True
while sign!="@":
i+=1
sign=a[i]
if(sign=="("):
stack.append(sign)
elif(sign==")"):
if len(stack)==0:
print("NO")
flag=False
break
else:
stack.pop()
if(flag):
print("YES")
|
5f111f170198c03fc8d52bff738bdcd016f6e452 | b99dd36a5e32c340f37dbeecf9c5b5b26e4aead2 | cash2one/xai | /xai/brain/wordbase/nouns/_concentrations.py | Python | py | 287 | permissive |
from xai.brain.wordbase.nouns._concentration import _CONCENTRATION
#calss header
class _CONCENTRATIONS(_CONCENTRATION, ):
def __init__(self,):
_CONCENTRATION.__init__(self)
self.name = "CONCENTRATIONS"
self.specie = 'nouns'
self.basic = "concentration"
self.jsondata = {}
|
4f6d7b07fa83841004d845bebc07373385543992 | 45d7886c98f1725523bdad22e389c9f4cd5c4205 | shamiksharma/popstats | /utils.py | Python | py | 2,438 | no_license |
#
# Utility helper methods
#
#
# string that shows all 16 hex digits in a long int (eg 0x1234567890abcde )
def hexstr(hex_num):
return format(hex_num, "#018x")
# rounds up a float to 0.0001
def roundup(fl):
return int( (fl*10000) + 0.5) / 10000.0
# helper func converts a list-of-dicts (from yaml) to a me... |
eabbdc03afd5b42c9c612cfb11cbc74e98aca110 | a0634940d174fed7810dc73c345006e1b57823ab | maurojp/clf4fallos | /clasificacion/clasificador.py | Python | py | 2,612 | no_license | from os import path
import pickle
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
def dummy_tokenizer(doc):
"""
Funcion para evit... |
d692277ed90f794e01fb30b860a74e303549b1fd | fd7eef171ba8f5ca6df5f787ffb71f3a02f6ae39 | estebango/coding-skills-sample-code | /coding202-parsing-json/activity-parse-2.py | Python | py | 549 | permissive | from urllib.request import Request, urlopen
import json
req = Request('https://devnetapi.cisco.com/sandbox/mse/api/config/v1/maps')
req.add_header('Authorization', 'Basic bGVhcm5pbmc6bGVhcm5pbmc=')
response = urlopen(req)
response_string = response.read().decode('utf-8')
json_object = json.loads(response_string)
pri... |
c022839ea44ea42116fc789d0a891399d8ca7bad | 3e3016d086eafe7a95939264676589663e3a111b | Subaru-PFS/obs_pfs | /python/lsst/obs/pfs/loadCamera.py | Python | py | 941 | no_license | import os
from functools import lru_cache
from lsst.afw.cameraGeom import Camera
from lsst.obs.base.yamlCamera import makeCamera
from lsst.utils import getPackageDir
__all__ = ("loadCamera",)
@lru_cache
def loadCamera(category: str = None) -> Camera:
"""Retrieve the cameraGeom representation of an instrument
... |
1e4cde030a5ef010f6583c0754eb93138eef2806 | 0ba7344715d34b229da67415b1656d02d3b55513 | arogozhnikov/einops | /scripts/setup.py | Python | py | 873 | permissive | """
This is a fake script, it is not used.
Seems github does not count contributions unless you have a setup.py
"""
__author__ = "Alex Rogozhnikov"
from setuptools import setup
setup(
name="einops",
version="0.7.0rc2",
description="A new flavour of deep learning operations",
long_description=open("REA... |
4206d45dac566f8885d17f9882654bd1251d7a94 | ab8ad5b875e67b1aaf3157404074891c00d90f66 | Djebouh/hass_config | /.homeassistant/custom_components/broadlink_power/sensor.py | Python | py | 3,070 | no_license | import binascii
import logging
import socket
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (CONF_HOST, CONF_MAC, CONF_NAME, CONF_TIMEOUT)
from homeassistant.helpers.entity import Entity
import homeassistant.helpers.config_validation as cv
# REQUI... |
451e6fe2f839dc4afbc0e1a89ab13c78386a31da | 41cb4c2419350d33674e44be9ed4233be5444c7d | sgz10010010/my_site | /article/migrations/0001_initial.py | Python | py | 1,757 | no_license | # Generated by Django 2.0.7 on 2019-06-22 03:41
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... |
af12a8d8ff864e6e504bb33fab3477117bad2051 | 4ebb33363bf09e84371e1593f242920b67ec857b | shreeshreee/LALM | /preprocess/__init__.py | Python | py | 1,553 | no_license | from utils import *
batch_size = 16
train_data = [
(load_file('../data/train.en.obj'), 0),
(load_file('../data/train.zh.obj'), 1),
(load_file('../data/train.fr.obj'), 3)
]
def get_shuffle_data(data):
dist_data = []
for one_data in data:
lang = one_data[1]
whole_data = sorted(one_d... |
1c8cca492bfe3bcb64189d612718dd84ace482aa | 8097de6943f3d0894725a104b4039a1edcc51288 | harbolkn/hatecrimes_usa | /states.py | Python | py | 710 | no_license | states = [
"Alabama",
"Alaska",
"Arizona",
"Arkansas",
"California",
"Colorado",
"Connecticut",
"Delaware",
"District of Columbia",
"Florida",
"Georgia",
"Hawaii",
"Idaho",
"Illinois",
"Indiana",
"Iowa",
"Kansas",
"Kentucky",
"Louisiana",
"Maine",
"Maryland",
"Massachusetts",
"Michigan",
"Minnes... |
b4f137c1793ce76ded43a616414279b543f7eec0 | 7b96e356995671f1bca4cecbe2be96ac36826382 | srinivasreddy/allhub | /allhub/projects/project.py | Python | py | 3,689 | permissive | from allhub.response import Response
from enum import Enum
class ProjectState(Enum):
OPEN = "open"
CLOSED = "closed"
ALL = "all"
_project_accept_header = "application/vnd.github.inertia-preview+json"
class ProjectMixin:
def repo_projects(self, owner, repo, state=ProjectState.OPEN):
url = "... |
28f3c57c5642595d07c6205873093811170d2ed4 | 864b7be6e51628ea1cc5c85e1bb1902547b11a8f | jmasonherr/temper | /public/rpi/keep_steady.py | Python | py | 5,536 | no_license | # Keep the temperature steady for grating tempered cocoa butter into
# -*- coding: utf-8 -*-
"""
We want 33.6 C for the cocoa butter
we want 33-34 for the chocolate mass
Regardless, you add this pure cocoa butter seed crystal at a
rate of 1% w/w to your chocolate. The different thing here is that
you add it at 92.5 F ... |
d1be0c0eb3de9e056a03ad2d784a3a52b3b26062 | 2613f1a5db9475151c1177c49852c889e9ba280e | kvendingoldo/masters | /src/python/utils/runner.py | Python | py | 837 | no_license | # -*- coding: utf-8 -*-
# @Author: Alexander Sharov
import logging
import time
import os
from multiprocessing import Process
def run(function, data, max_tasks):
logging.debug('Runner started with pid=%s' % os.getpid())
start_time = time.time()
logging.info('start time = %s' % start_time)
if max_tas... |
2c20bd53ae4df5af7af0ff450371fbec31896bdc | 723b7a6234d42b31195abfc5c03a4ef2f133504b | noothanprem/python | /functionalprograms/distance.py | Python | py | 549 | no_license | """
Name : distance.py
Date : 26/08/2019
Purpose : Prints the distance between the two points
"""
from Utility import utility
while True:
try:
#Getting the values of x and y from the user
x = int(input("Enter the value for x : "))
y = int(input("Enter the value for y : "))
... |
1a5073a2d62ac7cbc94781cd7ef8583d2dccd091 | 7f98793dce4671be7f58d7fef4d44d3ae0bdf3b4 | lvekoopmans/PyAutoLens | /test/integration/tests/phase_features/galaxy_redshifts.py | Python | py | 969 | permissive | import autofit as af
import autolens as al
from test.integration.tests import runner
test_type = "phase_features"
test_name = "galaxy_redshifts"
data_type = "lens_mass__source_smooth"
data_resolution = "LSST"
def make_pipeline(name, phase_folders, optimizer_class=af.MultiNest):
phase1 = al.PhaseImaging(
... |
a4a4dc17f905d13805d3436d66e80a860c4d2627 | afa02d805555957345354189427abb50f48ee99a | NishitHada/Final-Project | /GUI.py | Python | py | 3,362 | no_license | import tkinter
from tkinter import *
from backend import Analyze
from datetime import date
from svm_realtime import predict_svm
from nb_realtime import predict_nb
from nn_realtime import predict_nn
import sqlite3
conn = sqlite3.connect('dtab.db')
#conn.execute("create table User(User_Id int, Name text);")
#... |
e8c3550a2613e532ef17f6f05c935044c483d317 | 0a4b9a8728ec3d49f7958365b309bfdbd303fb6d | steveseguin/simple-object-trackers | /mosse-tracker/common.py | Python | py | 6,526 | no_license | #!/usr/bin/env python
'''
This module contains some common routines used by other samples.
'''
import numpy as np
import cv2
# built-in modules
import os
import itertools as it
from contextlib import contextmanager
image_extensions = ['.bmp', '.jpg', '.jpeg', '.png', '.tif', '.tiff', '.pbm', '.pgm', '... |
389385c0433aba828451827c226d0455f030d2af | faefe38eefbb135f5ac796015e35b3064764d92a | einverne/douban-export | /test/test_bookExport.py | Python | py | 1,769 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from unittest import TestCase
from exporter import *
from exporter.book import BookExport
from utils.logutil import get_logger
log = get_logger(__name__)
class TestBookExport(TestCase):
def setUp(self):
self.exporter = BookExport("einverne")... |
16638ce730fbc8d16336773e940154a030eda7e8 | e352ccf789b1387bf36a0cdc650b7c4cd0f912a8 | aswathyashokan96/guard | /iguard/settings.py | Python | py | 3,223 | no_license | """
Django settings for iguard project.
Generated by 'django-admin startproject' using Django 3.1.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
from... |
ca4642c91f46993f78920ae94b97eb0d2200b155 | cb006913556b7c17170058f6758717c40f425376 | mylove1/devel | /extend/exists.py | Python | py | 1,216 | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Copyright (c) 2015 yu.liu <showmove@qq.com>
# All rights reserved
"""扩展模块
"""
from datetime import datetime, timedelta
from arrow import Arrow
# 设置时间列表函数
def timeloop(start=datetime.now() + timedelta(days=-1),
end=datetime.now() + timedelta(days=0)):
... |
6fec1ee1c11f5ce78ba4871d45ffc12235d120df | c28818b8e9c36b12afd9c8caa4817da3ddab0142 | minghao2016/mwc_mutants | /code/processing/20180131_r1_O2_Y20I_RBS_titration_flow/analysis.py | Python | py | 2,110 | permissive | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import glob
import sys
sys.path.insert(0, '../../../../pboc-py')
import pboc.plotting
import pboc.transcription
colors = pboc.plotting.set_plotting_style(return_colors=True)
# Set the experiment constants.
DATE = 20180131
RUN_NO = 1
MUTANT = 'DNA... |
718e769c0b94106888f616739b42cce7450dfc2d | b4e3792f5bcd33748529b72314e7b9bb9c8bd576 | margipp/djangoproject | /djangofirstpr/blog/models.py | Python | py | 615 | no_license | from django.db import models
from django.conf import settings
from django.db import models
from django.utils import timezone
class Post(models.Model):
author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
title = models.CharField(max_length=200)
text = models.TextField()
crea... |
33384249fbfb20d7c63426dd1709963e3f586b4f | baaa9ae479fff1f4babc8c1e4a2d9e35670aa5ab | mcdermatt/roboticArm | /pydy-tutorial-human-standing-master/tests/roboticArmEndpointForces.py | Python | py | 11,675 | permissive | from __future__ import print_function, division
from sympy import symbols, simplify, trigsimp
from sympy.physics.mechanics import dynamicsymbols, ReferenceFrame, Point, inertia, RigidBody, KanesMethod
from sympy.physics.vector import init_vprinting, vlatex
from IPython.display import Image
from sympy.printing.pretty.pr... |
0a0d702da52d28d4528f41f6a32b27f489001db7 | d37a9fb74e857d2ca889beb9fdc74cbeb1254e9d | adirkson/sea-ice-timing | /code/NCGR-package/NCGR_v1.0.1/dcnorm.py | Python | py | 12,438 | permissive | # -*- coding: utf-8 -*-
import numpy as np
from scipy.stats import rv_continuous, norm
from scipy.optimize import fsolve, minimize
class dcnorm_gen(rv_continuous):
r"""A doubly-censored normal (DCNORM) random variable, censored numerically below :math:`a` and
above :math:`b`.
Notes
-----... |
82451a0fc7f233805eab7f74d1ef562df4cf0626 | 98427342f4f546785e934f8ac8d9ee7cc52c02f4 | aleozlx/pmsync | /sync_gen.py | Python | py | 634 | no_license | # -*- coding: utf-8 -*-
import sync
import sys
import time
import os.path
"""
Python version 3.3.2
Product version 7.3
"""
issue='发布'
ftpRoot='.'
interval=10
def run(once=False):
global issue,ftpRoot,interval
try:
sync.checkPath([issue]) #检查工作目录存在性
while True:
... |
14a4b818d70916befdd51c78ae6377eb087bbf05 | a691e10a5fb636a64636640d6c35e53c64c40ca0 | crowdbotics-apps/max-19474 | /max_19474/wsgi.py | Python | py | 395 | no_license | """
WSGI config for max_19474 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SET... |
69cd9e98c57b4d871f3f921be3c333f913a022f3 | a60761c9ae710452200126419fcf46c68ad9e678 | ewirkerman/halite_bot | /bots/ThoughtBot/networking2.py | Python | py | 5,687 | no_license | from hlt2 import *
from moves import Move
import socket
import traceback
from ctypes import *
import sys
import logging
import traceback
from random import shuffle
map_logger = logging.getLogger('bot')
try:
if len(map_logger.handlers) < 1:
base_formatter = logging.Formatter("%(asctime)s : %(levelname)s %(message)s"... |
beb68b35cffe2652e47ef015f992a3cb2525cbfa | 38f6c26a562da8bd7d832f2469c63439fa1e836e | takipsizad/mojang | /mojang/api.py | Python | py | 10,410 | permissive | """
The MIT License (MIT)
Copyright (c) 2020 https://github.com/summer
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, m... |
a50bd0c4b4a6c8331c1e3f5d8287a7876cbc14e7 | 8beb309222508243b55eb55a8ff63778d0206acf | 627163599/typeidea | /typeidea/wsgi.py | Python | py | 530 | no_license | """
WSGI config for typeidea project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
#os.environ.setdefault('DJANGO_SET... |
3dd054e3f1560b9d91357649c15642e9098fabe2 | 99bde68cb69cc108f6a0eb6b63ebc30ea3b67b77 | piloubazin/python_scripts | /IMCN_scripts/vasculature-extraction.py | Python | py | 3,335 | permissive | import nighres
import numpy
import nibabel
from glob import glob
import os
import subprocess
import scipy.ndimage
main_dir='/home/pilou/Projects/Ahead-Database/Vascular-Modeling/'
in_dir='/home/pilou/Projects/Ahead-Database/qMRI-Recomputed/'
out_dir=main_dir+'process_qmri2/'
final_dir=main_dir+'vessel-maps/'
subjects... |
2090bf2c3b5c25ab9abc65cbcc40a017d6209815 | 524ea477b37e932883851c0d32155b710fce29e3 | fifa007/Leetcode | /test/test_add_binary.py | Python | py | 349 | no_license | #!/usr/bin/env python2.7
'''
unit test for add binary
'''
import unittest
import src.add_binary
class add_binary_test(unittest.TestCase):
sol = src.add_binary.Solution()
def test1(self):
self.failUnless(self.sol.add_binary("1", "1") == "10")
def test2(self):
self.failUnless(self.sol.a... |
3252f7638f4eef76bc41f45e3c29fca75370c4ee | 8b0a8f032b6ef6d1ff3854fd05a0ccba733e483d | rmisiarek/django-svelte-backbone | /backend/api_auth/views.py | Python | py | 2,734 | no_license | from django.contrib.auth import authenticate, login, logout
from django.http import JsonResponse
from django.middleware.csrf import get_token
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_protect, ensure_csrf_cookie
from rest_framework import status
from rest_framewo... |
eb721445f0549e7652d485f94e5a57ffa765302f | 1aa88a7d682505ff1c471796763b1fbaec2e7ecc | ninutza/CarChat | /trajectory_generators/t_rural_multigrid.py | Python | py | 5,937 | no_license | #! /usr/bin/python
import sys
import random
import math
NO_INTERS_X = 11; # east-west dimension of the grid
NO_INTERS_Y = 11; # north-west dimension of the grid
GRAN = 160; #block size (in m) * 10 (scale) = 1600 m (1 mile)
STEP = 4; # distance moved at each time step
NO_VEH = 100; # number of vehicles for whi... |
73482d3efb286502de115a7fc0662c84acb1c9bf | 393741f73d867d85bde14db87415a9d28612a652 | jadliaissam/expressquiz | /exams/migrations/0004_auto_20210630_2327.py | Python | py | 658 | no_license | # Generated by Django 3.2.4 on 2021-06-30 22:27
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('exams', '0003_auto_20210630_2311'),
]
operations = [
migrations.RemoveFiel... |
a09a0353a35a735f02ccf64456e164c23a28c6aa | f37cde07e70a8eaa3ef8762aff862398c42e2b3e | silist/mmdet_dev | /configs/ttfnet/ttfnet_d53_2x.py | Python | py | 3,490 | permissive | # model settings
model = dict(
type='TTFNet',
pretrained='./pretrain/darknet53.pth',
backbone=dict(
type='DarknetV3',
layers=[1, 2, 8, 8, 4],
inplanes=[3, 32, 64, 128, 256, 512],
planes=[32, 64, 128, 256, 512, 1024],
norm_cfg=dict(type='BN'),
out_ind... |
49b7a5e454117d07c5f5633b6c709f905fb72e4a | 54a9276ed2c8c247c9d436159dc370892ac8fc40 | adamrher/cime | /scripts/lib/CIME/case/check_input_data.py | Python | py | 22,016 | permissive | """
API for checking input for testcase
"""
from CIME.XML.standard_module_setup import *
from CIME.utils import SharedArea, find_files, safe_copy, expect
from CIME.XML.inputdata import Inputdata
import CIME.Servers
import glob, hashlib, shutil
logger = logging.getLogger(__name__)
# The inputdata_checksum.dat file wil... |
1847233c79b5ff8d5c2af74a48d8cc1f89cb4687 | 7162aa09d17a13c3a8509561c9316465c4b7ab0c | llcclarke/pytorch-challenge | /helper.py | Python | py | 2,756 | no_license | import matplotlib.pyplot as plt
import numpy as np
from torch import nn, optim
from torch.autograd import Variable
def test_network(net, trainloader):
criterion = nn.MSELoss()
optimizer = optim.Adam(net.parameters(), lr=0.001)
dataiter = iter(trainloader)
images, labels = dataiter.next()
... |
edb37412592794ba6dd7205839edded3c24b0e93 | bf11772f89d9002cf74930d8906c68b92a72601c | alasdairtran/pytorch-transformers | /transformers/convert_gpt2_checkpoint_to_pytorch.py | Python | py | 2,856 | permissive | # coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
#
# 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... |
740de68fdbfda3e652090e0833a9e49adf5c3968 | d126d35d6ef82ff35861bc949a493dd947fd76aa | daymer/xWIKI_Karma | /CCv2_launch_example.py | Python | py | 2,683 | permissive | import os
import Configuration
import CustomModules.SQL_Connector
from Server.ServerLogic import xwd_fullname_to_link as xwd_fullname_to_link
from Server.ServerLogic import start_core_as_subprocess as start_core_as_subprocess
import logging
from sys import platform
from datetime import datetime
os.supports_bytes_envi... |
8a3ab76f8a0a80fc435d4285be214e15e85b698a | 71481d6882379915d4deb1c9c5b1278b0330722e | char-key/TDDwithPython | /superlists/settings.py | Python | py | 2,418 | no_license | """
Django settings for superlists project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)... |
fdb9c4efdc3f3bfd88eb53493be62347dab4744a | ec4211e2749280e51144768dc8fca97607ba7859 | hcwhwang/Analysis | /CATTools/ntuple/mcsample_cfi.py | Python | py | 3,516 | no_license | import FWCore.ParameterSet.Config as cms
kisti = "root://cms-xrdr.sdfarm.kr:1094///xrd"
mcsamples =[
{
"name": "zjet_amcatnloFXFX_pythia8",
"location": "/store/group/CAT/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/v7-3-1_RunIISpring15DR74-Asympt50ns_MCRUN2_74_V9A-v2/",
"subfolder": "150724_094819",
"entrie... |
16386f239b0b02947bfdbfb614139cbecc4ad862 | f65322d047156a2a73eb50d034168c4aca63fa5c | dennisliu1/learning | /problems/old/hackerrank/fraudulant_activity_notifications/fraudulent_activity_notifications_old_2.py | Python | py | 7,280 | no_license | #!/bin/python
import math
import os
import random
import re
import sys
import bisect
'''
try 2, it's easier to start from scratch.
The logic is:
create a trail storing the median.
Then go through the days and update the trail with the median
Since you know the starting median position, you can move it up/down
depe... |
920c542726180e60764e287aa36e2d9f1e7d9e96 | 2d9a8786eae7f076b8d74f0cfc48d7061b8803f4 | PraneethVankayala/Tasks-SCIT | /3.py | Python | py | 676 | no_license | from poisson import ar
from normal import s
import random
import csv
import numpy as np
import matplotlib.pyplot as plt
lp = []
ln = []
totallist = []
for i in range(100):
sp=random.choice(ar)
lp.append(sp)
for i in range(100):
n=random.choice(s)
ln.append(n)
totallist=lp+ln
print totallist
totallist=np.array([lp,... |
9ab8f79c6ddff4a6485dbe536360c40b1bbb415b | dccd5228245c86e3528e90b4a006f91ad3fe43c8 | tlswhdals/mySpartaSns | /mySpartaSns/urls.py | Python | py | 970 | no_license | """mySpartaSns URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-b... |
3afdf39d2f18473ab315c1e58206a941a91a7d32 | c9199a0e46f2a9aeecc7600d6770558737c5ce8e | KearabiloeAndCompany/crowdcoin-medialibrary | /LightMediaLibary/settings.py | Python | py | 3,809 | no_license | """
Django settings for LightMediaLibary project.
Generated by 'django-admin startproject' using Django 1.11.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
... |
5b42bb7d0a8f2102b91322f6fb0f9bdb9aa96d74 | 0a7206ac2afdb8c702a49d74b885db82198fd1e9 | foxhua/ironic | /ironic/tests/unit/drivers/modules/ilo/test_console.py | Python | py | 2,967 | permissive | # Copyright 2015 Hewlett-Packard Development Company, L.P.
# 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... |
dd4e7d43158d2cbfff58d13cf4a590248e820dc3 | 009116641ecf7bc7df20fcbd48ae8e08ff30a67e | bogdan-cornianu/plp | /plp/revised-plp/func-ex.13.py | Python | py | 591 | no_license | __author__ = 'bogdan.cornianu'
def memoize(function):
cache = {}
def inner(value):
if value in cache:
return cache[value]
result = function(value)
cache[value] = result
return result
return inner
@memoize
def recursive_fibonacci_for(n):
if n == 0:
... |
753ad0cf2de14ba6e5479b45df7916326f4729d0 | 5b0a4cccece8280f016d1d933be0f52445a87b0d | ealogar/servicedirectory | /client-libraries/sd-python-library/src/com/tdigital/sd/cache.py | Python | py | 9,402 | permissive | '''
(c) Copyright 2013 Telefonica, I+D. Printed in Spain (Europe). All Rights
Reserved.
The copyright to the software program(s) is property of Telefonica I+D.
The program(s) may be used and or copied only with the express written
consent of Telefonica I+D or in accordance with the terms and conditions
stipulated in t... |
c2a65c9dd6cd68bb3579d5822ec70b2c0842f73d | 62b6f507bc073abc21c5acdc819ce154d105c230 | wfp-ose/gaul-django | /setup.py | Python | py | 774 | no_license | #!/usr/bin/env python
from setuptools import setup
setup(
name='gaul-django',
version='1.0.0',
install_requires=[],
author='Patrick Dufour',
author_email='pjdufour.dev@gmail.com',
license='BSD License',
url='https://github.com/wfp-ose/gaul-django',
keywords='python gis wfp gaul',
d... |
5c39f27b66289c52461055db7f4b5a10255ae336 | 9b8257b6372722f0a183668670565e3046d6ee63 | cohesity/management-sdk-python | /cohesity_management_sdk/models/mount_volumes_params.py | Python | py | 4,337 | permissive | # -*- coding: utf-8 -*-
# Copyright 2023 Cohesity Inc.
import cohesity_management_sdk.models.entity_proto
import cohesity_management_sdk.models.mount_volumes_hyperv_params
import cohesity_management_sdk.models.mount_volumes_vmware_params
class MountVolumesParams(object):
"""Implementation of the 'MountVolumesPa... |
76d77f16c05aa60edc574e910ed7155b815c5007 | cdcdec852f367ac2e131ca927e5acf80128898a2 | schristison/schristison-Unit-112-Ex1---4-and-CR | /vidly/rental/migrations/0001_initial.py | Python | py | 1,292 | no_license | # Generated by Django 3.0.4 on 2020-03-21 17:05
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Genre',
fields=[
... |
e15e1c8139fc47b345406f0acacac5a07bfdba3a | 26a2b940ebd48b06976342fbdf80c345ca079283 | markus93/DSHomework2 | /src/client/protocol.py | Python | py | 5,962 | no_license | import pika
import json
import uuid
import time
from threading import Thread, Timer
from common import BaseListener
CONNECTION_TIMEOUT = 3
class RPCClient(object):
def __init__(self, args, parent):
"""
This class handles the RPC part. Any method called on this is sent to the server and the respo... |
498cb155c53b2453fcf1f5009c1ffce2488adc29 | 57f6df1ef7dffb3072bc7a5aaa9ec2cd244fe83e | argriffing/pykimuracore | /setup.py | Python | py | 352 | no_license | """
This setup.py assumes that the C code has already been generated using Cython.
"""
from distutils.core import setup
from distutils.extension import Extension
my_ext_name = 'pykimuracore'
my_ext = Extension(my_ext_name, [my_ext_name + '.c'])
setup(
name = my_ext_name,
version = '0.1',
ext... |
d735caa5994e455b11de006f26cb6efd51f5dd03 | e0fe2cc4a39387cdec1c611ff10484dc3f2eb46d | burdenp/AI_Class | /Project/ai 3/Util.py | Python | py | 878 | no_license | #Util class
import sys
import os
import time
from random import randint
import random
import string
#helper for input functions instead of having to call .trip.lower all the time
def cleanse(string):
return str(string).strip().lower()
#helper for yes input booleans is safe for non clensed answers in case of mista... |
f1287277dd2e8580ea845f1f776f080a46810a11 | bdf61f79312f4dc5bbf6ff1f8f566b03a2ee9dda | lucifurtun/issue-tracker | /apps/tracker/urls.py | Python | py | 661 | no_license | from django.conf.urls import url
from . import views
issue_list_view = views.IssueListView.as_view()
issue_create_view = views.IssueCreateView.as_view()
issue_detail_view = views.IssueDetailView.as_view()
issue_update_view = views.IssueUpdateView.as_view()
issue_delete_view = views.IssueDeleteView.as_view()
urlpatte... |
150fc26880a58b79eafe111c215a2fd9a57ac86a | 5500884f5d88789bb4cb0aa62eb7fe0c7ed84e61 | kirrlix1994/Data_Mining_in_Action_2018_Spring | /industry/hw02/gb_impl_checker.py | Python | py | 1,505 | no_license | # coding=utf-8
from sklearn.model_selection import cross_val_score
import numpy as np
import os
import sys
import imp
import signal
import pandas
import traceback
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
def signal_handler(signum, frame):
raise Exception("Timed out!")
class Checker(object):
... |
ec5a39ce7181a454fabd227a03b0c065d2fe2f1e | 33086fbb1be0e975b937d129f35578fe407c69ea | paulosjd/flask-apps | /marshmallow-demos/step03/schemas.py | Python | py | 264 | no_license | from flask_marshmallow import Marshmallow
from models import Puppy
ma = Marshmallow()
class PuppySchema(ma.ModelSchema):
class Meta:
model = Puppy
exclude = ['id', 'slug']
puppy_schema = PuppySchema()
puppies_schema = PuppySchema(many=True) |
7a27f695910e5b7a46ab6e31a5a679fcdbc450fe | 330954eff9021fc0ec99e3624ff07259deef3fc1 | leekiteak/Visitor_control_project | /Front_Web/node_server/face_recognition/demo_video.py | Python | py | 2,331 | no_license | import argparse
import numpy as np
import cv2
import os
from face_recognizer import FaceRecognizer
import sys
#print(sys.argv[1],sys.argv[2])
folder_path = "D:\\Visitor_control_project\\Front_Web\\node_server\\face_recognition\\faces_comp"
#dist_path = "/home/preeth/Downloads"
print("start python")
#c = 0
images = [... |
8ac9d1cb49fb776c9303c9a606b169dd95fb3639 | 680144db63b7f9ab147a5083c16e45bd78256401 | linth/django-vue | /django_vue/urls.py | Python | py | 940 | no_license | """django_vue URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... |
ec830697f57e4c12fc53f412c1aaefb13e94a46d | 89422f7ab464fcb3451267d291f852f58a7ebc2d | kif/HPP | /0_Python/run_class.py | Python | py | 975 | permissive | #!/usr/bin/env python
# coding: utf-8
from __future__ import division
__doc__ = """
demo of inside_polygon
"""
__author__ = "Jérôme Kieffer"
__copyright__ = "2014-16 ESRF"
__contact__ = "Jerome.Kieffer@esrf.fr"
__license__ = "MIT"
import inside_polygon
import numpy
import time
N = 24
L = 1024
if __name__ == "__main... |
dbfef1aec5e9fc67db21b3dd216230102554f318 | bc3f195066950c6f66f61445b7d6efd19e61f01d | joshg111/craigslist_kbb | /p/lib64-site-packages/twisted/conch/manhole.py | Python | py | 10,938 | permissive | # -*- test-case-name: twisted.conch.test.test_manhole -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Line-input oriented interactive interpreter loop.
Provides classes for handling Python source input and arbitrary output
interactively from a Twisted application. Also included is syn... |
60396e837843ad4835371e4d3ebf047190f18188 | 09b4b2307a3c1aeb073aa2b6cbf5870f83347401 | nstandev/qa | /work_experience.py | Python | py | 12,578 | no_license | import unittest
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from utils import get_logger, perform_login, perform_registration, send_c... |
478ed42c8d189023725626e12c66745a0dbf1572 | db0e2b72eca8eb515df40492bb13b8e1065b5c12 | dskho/writeups | /gits2015/giggles/client.py | Python | py | 2,102 | no_license | #!/usr/bin/python
import socket
import struct
import sys
TYPE_ADDFUNC = 0
TYPE_VERIFY = 1
TYPE_RUNFUNC = 2
OP_ADD = 0
OP_BR = 1
OP_BEQ = 2
OP_BGT = 3
OP_MOV = 4
OP_OUT = 5
OP_EXIT = 6
def createOperation(op, opnd1, opnd2, opnd3):
operation = struct.pack("H", op)
operation += struct.pack("Q", opnd1)
oper... |
414d00892f58440a5a9f41a593af6c4f38050d4c | 26ae341cc35dc98597763b48d5379c39d9a26c78 | wuyadie/envpool | /envpool/registration.py | Python | py | 2,736 | permissive | # Copyright 2021 Garena Online Private Limited
#
# 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 agr... |
aa765daee972679e5bac972d829fda8eb322ef32 | a0746f751312650258f1146d6893ebee02b7886a | Clinical-Genomics/chanjo | /tests/load/parse/test_load_parse_sambamba.py | Python | py | 304 | permissive | # -*- coding: utf-8 -*-
import pytest
from chanjo.load.parse import sambamba
from chanjo.exc import BedFormattingError
def test_depth_output():
exon_lines = ['# chrom chromStart chromEnd\n', '1 10 100\n']
with pytest.raises(BedFormattingError):
list(sambamba.depth_output(exon_lines))
|
571b5f42a02844944adca2a41cc175de034b5463 | 9e028a4d022508c87f6c3491a72b285585877c7c | nogaanaby/python-mmns | /mmn6/minesweeper.py | Python | py | 7,761 | no_license | """
Student: Noga Anaby
ID: 318298296
Assignment no. 6
Program: minesweeper.py
This is the mine-sweeper game
"""
#make all the classes as the conztnsus
#input the board data from the user
#add comments
import random
class MSSquare:
""" minesweeper square block class """
def __init__(self, hasMine=False, nei... |
cc68beef00c709359ee76f0af1f92a9ca48d036b | 40e26f0328d0e2d092dff63a60e11571743005f4 | Med98ML/GestionCabinetMedical | /appointment/migrations/0003_disponibilty_created_at.py | Python | py | 409 | no_license | # Generated by Django 2.2 on 2020-04-18 23:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('appointment', '0002_disponibilty'),
]
operations = [
migrations.AddField(
model_name='disponibilty',
name='created_at'... |
44e402c8750cfdc3acbe1d1668caaf6d3afab1aa | d46dd49118aed27d3df5dbc3cba54df4d0bd8588 | cuongnguyengit/FastSpeech2_VN | /text/phoneme.py | Python | py | 279 | no_license | import sys
try:
sys.path.append('./text')
except:
pass
list_phones = []
with open('./text/phoneme.txt', 'r', encoding='utf-8') as rf:
lines = rf.read().split('\n')
for line in lines:
if len(line.strip()) > 0:
list_phones.append(line.strip()) |
45c81cf636cf2816dc093563237b962a4f96e7c4 | 614048f4ed6fcdebf663cdb979cb96aea9b2d070 | mohit515/eecs583-dreamteam | /proj_pass/tests/test_cache/tester.py | Python | py | 7,026 | no_license | #! /usr/bin/python
import glob
import os
import re
import subprocess
import signal
import sys
import time
filename_base = "test_script"
path = "/home/pmastela/Datasets/Stock Information/NYSE"
nyse_path = "/home/pmastela/Datasets/Stock Information/NYSE/"
pig_output = "join_n.out"
max_reducers = 10
max_trials = 1
paral... |
63511749c27b879a982543f46ad81be17f63344e | 64299173b914f95f27cba3e1f9a8281574e297e2 | AlexKjes/kogark_3 | /fuzzer.py | Python | py | 2,565 | no_license | from handout import *
from matplotlib import pyplot as plt
import numpy as np
VERY_SMALL = 0
SMALL = 1
PERFECT = 2
BIG = 3
VERY_BIG = 4
SHRINKING_FAST = 0
SHRINKING = 1
STABLE = 2
GROWING = 3
GROWING_FAST = 4
BREAK_HARD = 0
SLOW_DOWN = 1
NONE = 2
SPEED_UP = 3
FLOOR_IT = 4
distance = [
lambda x: reverse_grade(x,... |
8f5bfb773b3badf35a7bf81a43469b3b9aabb54a | 40cdbc7b0aa4383743d5c4add05f95b491ea2142 | VanChilly/Shallow-Deep-Networks | /architectures/CNNs/WideResNet.py | Python | py | 3,910 | permissive | import torch
import torch.nn as nn
import numpy as np
import aux_funcs as af
import model_funcs as mf
class wide_basic(nn.Module):
def __init__(self, in_channels, channels, dropout_rate, stride=1):
super(wide_basic, self).__init__()
self.layers = nn.ModuleList()
conv_layer = []
c... |
7e323416e849d71b77e419761323ec3a660b3224 | c63761f20013d583526e478c2f221e380ab8d8e3 | delaven007/Date-analysis | /2-matplotlib-核心API-基本绘图-子图-刻度定位器-半对数坐标-散点图/3-figure.py | Python | py | 879 | no_license | """
窗口
"""
import numpy as np
import matplotlib.pyplot as mp
#新建一个窗体1
mp.figure('Figure1',facecolor='gray')
#为Figure1添加标题
mp.title('Figure 1')
#新建窗口2
mp.figure('Figure2',facecolor='lightgray')
#为Figure2添加标题
mp.title('Figure 2')
#把Figure1置位当前窗口
mp.figure('Figure1')
mp.title('Figure 1',fontsize=20)
#刻度参数 刻度标签文本大小... |
dc41cc31346114db000c010b5208a498cca26f68 | f6824bc6d0eb2b86a6e50c48f757724bc2d2bb7f | hwngenius/leetcode | /course/847_1.py | Python | py | 802 | no_license | from typing import List
from collections import defaultdict
from collections import deque
class Solution:
def shortestPathLength(self, graph: List[List[int]]) -> int:
N = len(graph)
dist = defaultdict(lambda: N * N)
for i in range(N): dist[(1 << i, i)] = 0
queue = deque([(1 << i, i... |
35d6e3ba1c6fbee443e96e64bc6f277c8a388f44 | 09683eeb642218ca817efe90867ddf7a96450bf8 | quanyang/angrop | /angrop/rop.py | Python | py | 14,218 | permissive | import angr
import simuvex
import chain_builder
import gadget_analyzer
import pickle
import inspect
import logging
import progressbar
from errors import RopException
from .rop_gadget import RopGadget, StackPivot
from multiprocessing import Pool
l = logging.getLogger('angrop.rop')
def _str_find_all(a_str, sub):
... |
920172c69a6cec4827d254835744a5555c03fb8b | 58fda5ca4771d54c1399e8bf5cb8dabb9410b616 | invalidid56/Context_Considering | /ex02_document_cluster/datagen.py | Python | py | 2,397 | no_license | import os
import pickle
import json
import logging
import logging.handlers
from konlpy.tag import Okt
def main():
# 포스태거 인스턴스 생성
tag = Okt()
# 설정 파일 파싱
with open('config_ex02.json') as conf:
config = json.load(conf)
DATA_HOME = config['DATA_HOME']
EX_HOME = os.path.join(config... |
73b295aa32c00c1d49969da3fd9cfa97ecdbc8bc | 66c3ac3a5402edd36ca75e7dc07520d2f2fe6191 | pavel-fokin/scanner-service | /app/detectify/models.py | Python | py | 409 | no_license | class Domain:
def __init__(self, name, properties=None):
self.name = name
self.properties = properties or {}
def __str__(self):
return f'{self.name}\n {self.properties}'
def add_property(self, name, value):
self.properties[name] = value
def as_dict(self):
retur... |
93a31952d198cd661d3539a4c614cf0f86e1a341 | 054eee8e99c1de67de7ce08790f9e1bb11263cf1 | bardia52/LeetCode | /Algorithms/add_bold_tag_to_string.py | Python | py | 961 | permissive | class Solution(object):
def addBoldTag(self, s, dict):
"""
:type s: str
:type dict: List[str]
:rtype: str
"""
arr = [False] * len(s)
for d in dict:
inx = l = 0
while True:
temp = s[inx:]
inx1 = s[inx:].fi... |
db88161ece063d95a8d2bbc6bfabc953aa61bed5 | eb07db22a7cdc04d14c397b53be4af64352eee0a | LumingMelody/Reverse_journey | /汽车之家.py | Python | py | 262 | no_license | from hashlib import md5
def get_pwd(pwd):
new_md5 = md5()
new_md5.update(pwd.encode('utf-8'))
return new_md5.hexdigest()
if __name__ == '__main__':
pwd = "123456"
password = get_pwd(pwd)
print(len(password))
# print(get_pwd(pwd))
|
e909f8e882e86fc19e20e8023cdbedfac3f18fe7 | 14ad95b7f44b682a81cc5ca30baa1340356c449f | tthatcher95/PyHAT_Point_Spectra_GUI | /point_spectra_gui/core/caltranMethods/caltran_cv_LASSODS.py | Python | py | 1,082 | permissive | import numpy as np
from PyQt5 import QtWidgets, QtCore
from point_spectra_gui.ui.caltran_cv_LASSODS import Ui_Form
from point_spectra_gui.util.Modules import Modules
class Ui_Form(Ui_Form, Modules):
def setupUi(self, Form):
super().setupUi(Form)
self.connectWidgets()
def get_widget(self):
... |
f7c3b70a306950a85ef28e9afe16dcc0022d68b3 | 038ce350b98c7e3e1277b09a03c07030981785b0 | Evelyn-agv/Ejercicios.Extra-POO | /examen/pregunta 9.py | Python | py | 416 | no_license | class Examen:
def __init__(self, lista=[]):
self.lista= lista
def ListaMenor(self,num):
listaMenor=[] #"ERROR"-->Es una lista no una tupla
for menor in self.lista:
if num > menor: #"ERROR"-->Se busca los numeros menores, no mayores
listaMenor... |
2b150eae6e1fcc38685e883871a58a2222eedb32 | df2ca205da6e3b95b6d272783ddf73db2fe77be3 | atsalolikhin-spokeo/parquet-tools | /parquet_tools/commands/show.py | Python | py | 2,968 | permissive | import sys
from argparse import ArgumentParser, Namespace
from logging import getLogger
from typing import List, Optional
import pandas as pd
from tabulate import tabulate
from .utils import (FileNotFoundException, InvalidCommandExcpetion,
ParquetFile, get_datafame_from_objs,
t... |
f687739b131a419ab64adfa5e254dcba4ea8100b | e73ff97c9c20120337e2282b85e4903e80d3f54e | aryanpanpalia/Synthesia2Midi | /converters/partial_converter.py | Python | py | 5,845 | permissive | import json
import os
import sys
from multiprocessing import Process
import cv2
import matplotlib.pyplot as plt
import numpy as np
import py_midicsv as pm
sys.path.append('.')
from core import youtube2frames, frames2matrix, matrix2csv
def show_image(path):
image = cv2.imread(path)
image = cv2.cvtColor(imag... |
2d09649fe06c724eabfcdc113d906211ca3d8fb0 | 10746b451e9c8b8dc329c6867f07e0933f56a605 | mrpyrex/neupytech | /backend/job/schema.py | Python | py | 1,250 | no_license | import graphene
from graphene_django import DjangoObjectType
from .models import Job, Profile
from graphql import GraphQLError
# from users.schema import AuthorType
from django.db.models import Q
class JobType(DjangoObjectType):
class Meta:
model = Job
class ProfileType(DjangoObjectType):
class Meta... |
2093525092b608cd0c1fb70c864428f867039861 | 22f60d535906bc858606ca52cf5498c37ba1a58d | teromakotero/microbit-projects | /radio-demo/servo.py | Python | py | 790 | no_license | from microbit import *
import radio
# Servo
MIN_VOLTAGE = 0.02
MAX_VOLTAGE = 0.12
# Motor
#MIN_VOLTAGE = 0.0
#MAX_VOLTAGE = 1.0
pin0.set_analog_period(20) # Valmistellaan pin0 servoa varten (asetetaan PWM periodi 20 millisekuntiin)
radio.on() # Radio päälle
radio.config(channel = 50) # Valitse kanava 0-100 väliltä
... |
02ba5f60504e59a0c86029e679c7680c87d7b6b9 | 28d36d614cc36b7ae7392ec36f3aa03443eaa7a6 | yubowennjust/paper_hub | /cvpr16.py | Python | py | 2,020 | no_license | import os
import re
import urllib
import requests
#get web context
def get_context(url):
"""
params:
url: link
return:
web_context
"""
web_context = requests.get(url)
return web_context.text
url = 'http://openaccess.thecvf.com//CVPR2016.py'
web_context = get_context(url)
#fi... |
1fe437f29bc2fce494f7d647a7c7edab69dbc23a | 035adee9369167e4317c5e72fa60a6e16468f76f | lewisvtu/EagleFlightTool | /utils.py | Python | py | 13,115 | no_license | import matplotlib.pyplot as plt
import numpy as np
from DBS.dbgrabber import dbsPull
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from numpy import pi
from scipy.interpolate import UnivariateSpline, interp1d, spline
Expansion_F_snaps = np.array([0.05, 0.06, 0.09, 0.10, 0.11, 0.12, 0.14, 0.15... |
8fe1e0d0d5fb6aa61cf95e55ad1703cac3680a46 | ed6b8b7738f254c6940d42170875bd84c3ae3c28 | ToucanToco/toucan-data-sdk | /tests/utils/postprocess/test_cumsum.py | Python | py | 1,211 | permissive | from copy import copy
import pandas as pd
from toucan_data_sdk.utils.postprocess import cumsum
def test_cumsum():
"""It should return result for cumsum"""
data = pd.DataFrame(
[
{"index_col": "A", "date_col": "20170109", "value": 10},
{"index_col": "A", "date_col": "20170209"... |
bba8aa2a50f33f377c40ad6c66a93ed989855114 | 69833b0d7580667ef55bfe6bc545989cfa1e138f | S1ro1/WeatherBot | /get_data.py | Python | py | 2,357 | no_license | from datetime import datetime
import requests
from convert_to_chart import convert
url = "https://api.openweathermap.org/data/2.5/onecall?lat="
url2 = "https://api.openweathermap.org/data/2.5/forecast?lat="
def get_5day_weather(coordinates, key):
request_url = f"{url2}{coordinates[0]}&lon={coordinates[1]}&units=m... |
3abaa9cb7d3666e1953c0a2d72a2015a06e182dd | 83cf419b1e282f0930afa0a94aefdd7309f813c4 | CobaltGoldCS/LibraryDataBase | /Administrator_Lib_Program/GUI.py | Python | py | 11,166 | no_license | import tkinter
import Backend
from pathlib import Path
# If you really need to change the files
iconpath = Path.cwd() / 'icons' / 'icon.ico'
mainicon = Path.cwd() / 'icons' / 'mag.ico'
datapath = Path.cwd() / 'library_database.db'
class menu():
def __init__(self, searchicon, mainpath, database):
self.iconpath = ... |
25908e25f333d28b54b84993a07a6f1acd92accc | e8c3da009a41e5d11f9e1e1bcf8619fe6e384723 | ZhangHang95/Torchrec | /torchrec/model/mf/bpr.py | Python | py | 534 | no_license | from torchrec.model import basemodel, loss_func, scorer
from torchrec.ann import sampler
import torch
class BPR(basemodel.UserItemIDTowerRecommender):
def build_user_encoder(self, train_data):
return torch.nn.Embedding(train_data.num_users, self.embed_dim)
def config_loss(self):
return los... |
b86c38cbac4b5e14c1cb2e85e3962fd99aa84927 | be0eaba3050580d82db3b5d7f224a17459e97d18 | g1en1995/LearningFlask | /RESTapi_with_FLASK/test.py | Python | py | 636 | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat May 29 10:25:10 2021
@author: gcferna2
"""
import requests
# import json
BASE = "http://127.0.0.1:5000/"
response = requests.put(BASE + "video/4", {"name": "glen4", "likes" : 40000, "views": 100000})
print(response.json())
input()
response = requests.patch(BASE + "vide... |
0df53589b89e7fe189345220a2f42972f4b45e2a | 8e3005c7cb4d27573018a3de2218ac77d1e02f5b | y0-causal-inference/y0 | /tests/test_parser/test_causaleffect.py | Python | py | 1,474 | permissive | # -*- coding: utf-8 -*-
"""Test the causaleffect probability expression parser."""
import unittest
from y0.dsl import C, D, P, Sum, Variable
from y0.parser import parse_causaleffect
from y0.parser.ce.grammar import sum_pe
U_1 = Variable("U_1")
class TestCausaleffectGrammar(unittest.TestCase):
"""Tests for par... |
70166492ada909c436da84c269c56509728d37f6 | 54e40ce742a766f261d02dca9b82eeac9306322b | BeaverInc/covid19CityMontreal | /Lib/site-packages/twisted/spread/flavors.py | Python | py | 23,475 | permissive | # -*- test-case-name: twisted.spread.test.test_pb -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This module represents flavors of remotely accessible objects.
Currently this is only objects accessible through Perspective Broker, but will
hopefully encompass all forms of remote access... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.