id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
5101460 | <gh_stars>0
from skimage import data, filters, feature
from skimage.morphology import disk
import matplotlib.pyplot as plt
def ex_1(): # sobel,roberts,scharr,prewitt,canny operator
img = data.camera()
edges = filters.sobel(img)
edges1 = filters.roberts(img)
edges2 = filters.scharr(img)
edges3 = ... | StarcoderdataPython |
5029650 | <reponame>yessGlory17/2ImageDifferent
import cv2
import numpy
class Resim:
def __init__(self, image):
self.src = image
img = cv2.imread(image)
self.image = img
w, h, c = img.shape
self.height = w
self.width = h
#self.channels = c
def resimBoyutunuGetir(... | StarcoderdataPython |
1775246 | from django.db import models
from django.utils.translation import ugettext_lazy as _
from imdb import IMDb
from cinemanio.core.models import Movie, Person, Genre, Language, Country
from cinemanio.sites.exceptions import PossibleDuplicate, NothingFound, WrongValue
from cinemanio.sites.models import SitesBaseModel
cla... | StarcoderdataPython |
6403942 | # Copyright (c) 2020 PaddlePaddle 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | StarcoderdataPython |
8078339 | import rospy
from std_srvs.srv import Empty
from gazebo_msgs.msg import ModelState
from gazebo_msgs.srv import GetModelState, SetModelState
class GazeboServiceCaller:
def __init__(self, model_name="PenguinPi"):
"""
Args:
model_name (str, optional): Name of model you want to call servic... | StarcoderdataPython |
5197709 | import database
import libpyprjoxide
def main():
db = libpyprjoxide.Database(database.get_db_root())
libpyprjoxide.copy_db(db, "LIFCL", "EBR_10", ["TRUNK_L_EBR_10", ], "PEWC", "")
if __name__ == '__main__':
main()
| StarcoderdataPython |
3441425 | <filename>graphs/stepping_numbers.py
#https://practice.geeksforgeeks.org/problems/stepping-numberswrong-output1813/1/?page=1&company[]=Amazon&category[]=DFS&sortBy=submissions#
from collections import deque
class Solution:
def bfs(self , num , n , m):
count = 0
q = deque()
q.append(num)
... | StarcoderdataPython |
1782505 | # Tile Dim. - 1x4 : To Fill nx4
from sys import stdin
def dp(n: int):
if n<4:
return 1
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 1
dp[2] = 1
dp[3] = 1
for i in range(4, n+1):
dp[i] += dp[i-1] + dp[i-4]
return dp[n]
def main():
t = int(input())
for i in r... | StarcoderdataPython |
3395988 | import torch
from .classification import ASSANetCls
from .segmentation import ASSANetSeg
from .losses import LabelSmoothingCrossEntropyLoss, MultiShapeCrossEntropy, MaskedCrossEntropy
from torch.optim.lr_scheduler import _LRScheduler, MultiStepLR, CosineAnnealingLR
def build_classification(config):
if config.mode... | StarcoderdataPython |
4936878 | def fibonacci(n, sequence=(0, 1)):
# sequence=(0, 1) -> Tuple containing the first 2 values of the fibonacci sequence
# If the 'n' is less than the len(sequence), the first 2 elements of the fibonacci
# sequence, 0 and 1, are already returned
return sequence if len(sequence) == n else \
fibonac... | StarcoderdataPython |
6612766 | <filename>torchreid/models/resnet.py
"""
Code source: https://github.com/pytorch/vision
"""
from __future__ import division, absolute_import
import copy
import torch
import torch.utils.model_zoo as model_zoo
import torch.nn.functional as F
from torch.nn import init
from torch import nn
import math
from scipy.stats im... | StarcoderdataPython |
3441686 | import os
import lmdb # install lmdb by "pip install lmdb"
import cv2
import numpy as np
def checkImageIsValid(imageBin):
if imageBin is None:
return False
imageBuf = np.fromstring(imageBin, dtype=np.uint8)
img = cv2.imdecode(imageBuf, cv2.IMREAD_GRAYSCALE)
imgH, imgW = img.shape[0], img.shape... | StarcoderdataPython |
3432018 | <filename>pj_login/login/views.py<gh_stars>0
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from login.models import Bbs
from login.serializers import BbsSerializer
# 요청 url 인 bbs/ 에 대해서 urls.py 에 정의된 view.bbs_list 가 호출된다.
@api_view(['GET... | StarcoderdataPython |
350959 | <reponame>mrdakj/service-fabric-cli
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R)... | StarcoderdataPython |
8040159 | <reponame>PRIS-CV/BSNet
import numpy as np
import torch
from torch.autograd import Variable
import os
import glob
import h5py
import configs
import backbone
from data.datamgr import SimpleDataManager
from io_utils import parse_args, get_best_file
def save_features(model, data_loader, outfile ):
f = h5py.File(o... | StarcoderdataPython |
54199 |
import random
square = [[1,2,3],[4,5,6],[7,8,9]]
def get_square():
line =[i for i in range(1,10)]
lst = random.sample(line, 9)
square = [lst[i:i + 3] for i in range(0, len(lst), 3)]
return square
def valid_line(line):
if sorted(line) == [1,2,3,4,5,6,7,8,9]: return True
else: return False
de... | StarcoderdataPython |
5080528 | <filename>tf_utils/distributions_test.py<gh_stars>100-1000
import numpy as np
import tensorflow as tf
from distributions import logsumexp, compute_lowerbound, repeat
class DistributionsTestCase(tf.test.test_util.TensorFlowTestCase):
def test_logsumexp(self):
a = np.arange(10)
res = np.log(np.sum(n... | StarcoderdataPython |
1786437 |
def parse(grammar):
# Extract every line of the file and put it into lines array
lines = [line.strip() for line in grammar]
# Representing the grammar as a python dict
grammar_dict = {}
# first elements in lines is consisted of all starting symbols
starting_symbols = filter(None, lines[0].split... | StarcoderdataPython |
6424187 | <reponame>Seniatical/Hashables
from .key import DictKeySet
from .value import DictValueSet
from .item import DictItemSet | StarcoderdataPython |
3358825 | r"""
Labelled permutations
A labelled (generalized) permutation is better suited to study the
dynamic of a translation surface than a reduced one (see the module
:mod:`sage.dynamics.interval_exchanges.reduced`). The latter is more
adapted to the study of strata. This kind of permutation was
introduced by Yoccoz [Yoc05... | StarcoderdataPython |
1970052 | <filename>export_pnml.py
import uuid
import xml.dom.minidom
class PNML():
def __init__(self, net_id, net_name):
self.net_id = net_id
self.net_name = net_name
self.place = []
self.transition_list = []
self.transition = []
self.transition_dict = {} # the... | StarcoderdataPython |
6427969 | <filename>HuaweiDialGrpc/producer_thread.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
功能:生产数据类,该类主要用于从路由器采集数据,包括dialin(Subscribe)和dialout(DataPublish)
版权信息:华为技术有限公司,版本所有(C)
修改记录:w30000618 创建
"""
import threading
import time
from concurrent import futures
import grpc
from data_item import DataItem
from globa... | StarcoderdataPython |
5186222 | from lmnop import __version__
def test_version():
assert __version__ == "0.0.0" # noqa: S101
| StarcoderdataPython |
246160 | <reponame>monday-lesley/ponyos<gh_stars>0
#!/usr/bin/python3
"""
Calculator for ToaruOS
"""
import subprocess
import sys
import cairo
import yutani
import text_region
import toaru_fonts
from button import Button
from menu_bar import MenuBarWidget, MenuEntryAction, MenuEntrySubmenu, MenuEntryDivider, MenuWindow
from ... | StarcoderdataPython |
9791182 | from django.contrib import admin
from django.urls import path, include
from accounts.views import Top
from . import views
app_name = 'ByeByeTODO'
urlpatterns = [
path('', views.tologin, name='tologin'),
# path('', views.index, name='index'),
#path('accounts/login/', views.LoginView.as_view(), name='login... | StarcoderdataPython |
6413072 | <gh_stars>0
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
from django.utils.text import slugify
from datetime import datetime
from realtor.models import Realtor
from django.urls import reverse
from autoslug import AutoSlugField
# Create your models here.
PR... | StarcoderdataPython |
208108 | import pytest
import tempfile
import zipfile
import zipfile_deflate64
from pathlib import Path
from skultrafast.quickcontrol import QC1DSpec, QC2DSpec, parse_str, QCFile
from skultrafast.data_io import get_example_path, get_twodim_dataset
def test_parse():
assert (parse_str('-8000.000000') == -8000.0)
assert... | StarcoderdataPython |
1882887 | <reponame>grvkmrpandit/competitiveprogramming
def combine(left,right):
z=min(left[1],right[2])
a=left[0]+right[0]+z
b=left[1]+right[1]-z
c=left[2]+right[2]-z
return (a,b,c)
def build(idx,l,r):
if l==r:
if string[l]=='(':
tree[1]+=1
else:
tree[2]+=1
e... | StarcoderdataPython |
6535542 | # coding=utf-8
# Copyright (C) 2015 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is ... | StarcoderdataPython |
3259293 | """ Implementation of Odd-Even Sort algorithm
"""
def oddeven(data):
""" OddEvenSort is a variation of bubble sort where the sorting is divided
into two phases, Odd and Even Phase and it runs until all the elements
are sorted. In the odd phase we perform bubble sort on odd indexed
elements and in the ... | StarcoderdataPython |
6549265 | <filename>tanksworld/minimap_util.py
# ©2020 Johns Hopkins University Applied Physics Laboratory LLC.
import cv2
import numpy as np
import math, random, time
IMG_SZ = 128 #how big is the output image
UNITY_SZ = 100.0 #what is the side length of the space in unity coordintaes
SCALE = 120.0 #what is t... | StarcoderdataPython |
11245925 | from .importer import *
from .settings import *
__all__ = [
'DraftstarsCSVImporter', 'DraftstarsAFLSettings', 'DraftstarsGolfSettings', 'DraftstarsNBASettings'
] | StarcoderdataPython |
120327 | import os
import time
import random
from multiprocessing import Process, Queue
def _monte_carlo_processing(x_nums, fun, cons, bounds, random_times, q: Queue):
"""
monte_carlo 的子进程函数,完成随机试验,向 Queue 传递结果
"""
random.seed(time.time() + os.getpid())
pb = 0
xb = []
for i in range(random_times):
... | StarcoderdataPython |
1877641 | import helpfunctions as hlp
import numpy as np
import scipy.stats as stat
import scipy.special as spec
import nestedFAPF2 as nsmc
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-d", type=int, help="State dimension")
parser.add_option("--tauPhi", type=float, help="Measurement precision")
p... | StarcoderdataPython |
230177 | # https://leetcode.com/problems/minimum-operations-to-make-the-array-increasing/
# Return the minimum number of operations needed to make nums strictly increasing.
# An array nums is strictly increasing if nums[i] < nums[i+1] for all 0 <= i < nums.length - 1.
# An array of length 1 is trivially strictly increasing.
im... | StarcoderdataPython |
273894 | <reponame>Tian99/Robust-eye-gaze-tracker
#!/usr/bin/env python
"""Video eye tracking
Usage:
vid_track <vid.mov> <behave.csv> [--box <x,y,w,h>] [--dur <len_secs>] [--start <start_secs>] [--method <method>] [--fps <fps>]
vid_track methods
vid_track (-h | --help)
vid_track --version
Options:
--box POS init... | StarcoderdataPython |
11233004 | <gh_stars>1-10
import sys
import os
def redirect(stdout=None, stderr=None):
for dev, v in [(stdout, 'stdout'), (stderr, 'stderr')]:
s = dev or os.getenv(v.upper())
if s:
setattr(sys, v, open(s, 'w'))
| StarcoderdataPython |
4834184 | #!/usr/bin/env python3
# mc_gibbs_lj.py
#------------------------------------------------------------------------------------------------#
# This software was written in 2016/17 #
# by <NAME> <<EMAIL>>/<<EMAIL>> #
# and <NAME> <<EMAIL>> (... | StarcoderdataPython |
6705655 | def test_demo():
"""
Assign a value to `x` after an assert
Testsuite will want to ensure that we print `x = 1`, which was the value at
the time of the assert
"""
x = 1
assert x == 2
x = 2
| StarcoderdataPython |
106014 | from .LevelTile import LevelTile
from GLOBAL_DATA import Level_Tile_Data as LTD
from ..Minigames.Lockpick import Lockpick
class DoorTile(LevelTile):
_closed = True
_lock_level = 0
_lockpicking_minigame = None
def __init__(self, appearance, lock_level=0):
super().__init__(appearance)
i... | StarcoderdataPython |
9654805 | import pytest
from pytest import fixture
from command_line.main import SingleFileExperimentFactory, CLI
from methods import Method
from models import Sample, Gene
from .utilities import parsing_error
from .utilities import parsing_output
from .utilities import parse
def make_samples(samples_dict):
"""Create sam... | StarcoderdataPython |
331860 | <gh_stars>0
import os
import win32com.client as win32
class Simulation():
AspenSimulation = win32.gencache.EnsureDispatch("Apwn.Document")
def __init__(self, PATH, VISIBILITY):
self.AspenSimulation.InitFromArchive2(os.path.abspath(PATH))
self.AspenSimulation.Visible = VISIBILITY
... | StarcoderdataPython |
49508 | <gh_stars>0
import logging
import vispy.io
from .Canvas import Canvas
from ... import draw
import numpy as np
from ..Scene import DEFAULT_DIRECTIONAL_LIGHTS
logger = logging.getLogger(__name__)
def set_orthographic_projection(camera, left, right, bottom, top, near, far):
camera[:] = 0
camera[0, 0] = 2/(right ... | StarcoderdataPython |
9665488 | <reponame>phohenecker/exp-base<filename>examples/basic_setup/main.py
# -*- coding: utf-8 -*-
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# BSD 2-Clause License ... | StarcoderdataPython |
5116945 | from sqlalchemy.orm import relationship
from .weak_entities import event_has_host
from .. import db, flask_bcrypt
# Based on 'User' example https://github.com/cosmic-byte/flask-restplus-boilerplate
class Host(db.Model):
""" Event hosts """
__tablename__ = "host"
id = db.Column(db.Integer, primary_key=Tr... | StarcoderdataPython |
8029436 | <reponame>jrood-nrel/percept
import sys
sys.path.insert(0,"../build/build.dir/packages/PyTrilinos/src/stk/PyPercept")
from math import *
from numpy import *
import unittest
import time
import print_table
from PerceptMesh import *
class StringFunctionUnitTests(unittest.TestCase):
def setUp(self):
self.... | StarcoderdataPython |
11226024 | # -*- coding: utf-8 -*-
# Copyright (C) 2020 <NAME>
# This code is licensed under the BSD 3-Clause license (see LICENSE for details).
import logzero
import PyQt5.QtCore
class AbstractIPC(object):
"""
Encapsulates code that both the producer and the consumer requires.
"""
def __init__(self, id, key_f... | StarcoderdataPython |
397060 | <filename>hashtable/two_sum.py<gh_stars>0
#Question:
#Given an array of integers, return indices of the two numbers such that they add up to a specific target.
#You may assume that each input would have exactly one solution, and you may not use the same element twice.
#Example:
#Given nums = [2, 7, 11, 15], target = 9,... | StarcoderdataPython |
4802513 | # Copyright (c) 2021, TNO
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the followi... | StarcoderdataPython |
3302822 | <filename>hexa-beta/userRegistrationScreen.py
__author__ = 'guru'
#state 40 = enter the phone number
#state 61 = phone number already exist try new number
#state 100 = Ask's user to place their 1st finger on FPS
#state 101 = Ask's user to place their 2st finger on FPS
#state 20 = Scanning ur finger now
#state 30 = re... | StarcoderdataPython |
26209 | <reponame>wangjing1215/COM-DEV
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'command_list.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doi... | StarcoderdataPython |
4813038 | # RTの基本データ。
from typing import Optional
from discord.ext import commands
class Colors:
normal = 0x0066ff
unknown = 0x80989b
error = 0xeb6ea5
player = 0x2ca9e1
queue = 0x007bbb
data = {
"prefixes": {
"test": [
"r2!", "R2!", "r2.", "R2.",
"りっちゃん2 ", "りっちゃん2 ",... | StarcoderdataPython |
11312395 | #!/usr/bin/python
# Written for Python version 2.7
# Hello World server in Python
# Binds REP socket to tcp://*:5555
# Expects b"Hello" from client, replies with b"World"
import time
import zmq
print 'pyzmq version: ', zmq.pyzmq_version()
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://*:... | StarcoderdataPython |
3589733 | <reponame>TristanGomez44/openseg.pytorch
import numpy as np
from PIL import Image
import glob
for path in glob.glob("results/*npy"):
npFile = np.load(path)
if len(npFile.shape) == 4:
npFile = npFile[0].transpose(1,2,0)
else:
if npFile.shape[0] == 1:
npFile = npFile[0]
if ... | StarcoderdataPython |
6674878 | import numpy as np
if __name__ == '__main__':
dim = tuple(map(int, input().split()))
np.set_printoptions(sign=' ')
print(np.eye(dim[0], dim[1])) | StarcoderdataPython |
8050872 | from bson.objectid import ObjectId
import gridfs
import Controllers.Common as common
import Controllers.Constants as cons
from Controllers.FilesModel import Files
from Controllers.ECGModel import ECG
def connect_gridfs(db):
return gridfs.GridFS(db)
def save_ecg_property(ecg_col, ecg_property: ECG):
jsonecg_... | StarcoderdataPython |
3261784 | # Author : <NAME>
# Project3 Differential Astar Turtlebot
import pygame
import numpy as np
import sys
import os
import math
from time import time
from pygame.locals import *
import argparse
# Colors
sky_blue = [135,206,235]
red = [255,0,0]
lime = [0,255,0]
white = [255,255,255]
# Robot Parameters
radius=0.076/2
... | StarcoderdataPython |
1933078 | <filename>flow_apps/base/river/core/classworkflowobject.py
from django.contrib.contenttypes.models import ContentType
from river.driver.mssql_driver import MsSqlDriver
from river.driver.orm_driver import OrmDriver
from river.models import State, TransitionApprovalMeta, Workflow, app_config, TransitionMeta
class Clas... | StarcoderdataPython |
337074 | import base64
def encrypt(private):
public = base64.urlsafe_b64encode(private.encode()).decode()
return public
def decrypt(public):
private = base64.urlsafe_b64decode(public.encode()).decode()
return private | StarcoderdataPython |
8061663 | # Generated by Django 3.2.10 on 2022-01-01 19:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('orders', '0020_OrderAuthorMigrationFix'),
]
operations = [
migrations.AddConstraint(
model_name='order',
constraint... | StarcoderdataPython |
3593955 | def displayHero():
print("I am hero") | StarcoderdataPython |
9629115 | from Recognizers_POMDP_Antie_Sim import *
class PomdpAntiePeriphSimRecognizer(PomdpAntieSimRecognizer):
def recNeedTurn(cls,desc,viewCache):
return (len(viewCache)<4 and
False
)
recNeedTurn = classmethod(recNeedTurn)
| StarcoderdataPython |
1866394 | <reponame>juntaoy/dali-md<filename>nn_md.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import random
import json
import threading
import numpy as np
import tensorflow as tf
import util
import md_ops
class NNMD(object):
def __init__(self, config):
... | StarcoderdataPython |
1830475 | <filename>sopel_modules/SpiceBot/Server.py<gh_stars>1-10
# coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function
"""
This is the SpiceBot Server system.
"""
from .Config import config as botconfig
class BotServer():
"""This Logs all server values of relevance'"""
def ... | StarcoderdataPython |
4815356 | from google.cloud import secretmanager
from google.api_core.exceptions import NotFound
import structlog
logger = structlog.get_logger()
def get_secret_list(project_id, secret_id) -> list:
"""
Secrets are managed by Google Secret Manager.
This method returns a list of the currently enabled versions
o... | StarcoderdataPython |
155502 | <reponame>egonrian/google-research
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# 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-... | StarcoderdataPython |
6436787 | # coding=utf-8
import requests
import time,datetime
#import json
#import smtplib
#import hashlib
#import pymysql
#from datetime import datetime
import pandas as pd
N =5
keys = ['牛奶','床',]
#获得即时数据
def get_real_time_data():
c_time = int(time.time())
headers = {
'Accept': 'text/html,application/xhtml+... | StarcoderdataPython |
4848678 | # Copyright (c) 2005-2006 gocept gmbh & co. kg
# See also LICENSE.txt
# $Id$
import unittest
from Products.AlphaFlow.tests.AlphaFlowTestCase import AlphaFlowTestCase
from Products.AlphaFlow.interfaces import \
IProcess, IProcessVersion
from Products.AlphaFlow.process import Process, ProcessVersion
class Proces... | StarcoderdataPython |
4941254 | import os # to read environment variables and deal with directory stuff
import sys # for sys.exit only?
import argparse # for taking arguments
import httpx # to make http requests to JIRA and Slack
import json # for working with responses from Jira, etc.
import untangle # to pull out specific data from the workflow xml... | StarcoderdataPython |
1886142 | import numpy as np
import sys
import time
sys.path.append('../build')
from _C_flare import SparseGP_DTC, DotProductKernel, B2_Calculator, \
StructureDescriptor
# Load training data.
NiTi_data = np.load('NiTi_AIMD.npz')
positions = NiTi_data['positions']
forces = NiTi_data['forces']
cells = NiTi_data['cells']
stres... | StarcoderdataPython |
1977615 | import unittest
import psp0
class PSP0TestCase(unittest.TestCase):
def test_construir(self):
esperado = (1, None)
observado = psp0.construir(1)
self.assertEqual(esperado, observado)
esperado = (1.5, None)
observado = psp0.construir(1.5)
self.assertEqual(esperado, o... | StarcoderdataPython |
6699016 | <reponame>django-doctor/lite-api<gh_stars>0
from django.utils import timezone
from rest_framework import serializers
from rest_framework.fields import CharField
from rest_framework.relations import PrimaryKeyRelatedField
from api.applications.enums import (
ApplicationExportType,
ApplicationExportLicenceOffici... | StarcoderdataPython |
5103668 | # This program deletes the element 'Lithium' from a given tuple of elements
# Collection of elements
elements = (
"Hydrogen", 1,
"Carbon", 6,
"Lithium", 3,
"Titanium", 22,
"Iron", 26,
"Helium", 2,
"Potassium", 19,
"Calcium", 20,
)
# Assume that 'Lithium' is not in the collection so... | StarcoderdataPython |
9626837 | <gh_stars>0
# -*- coding: utf-8 -*-
import os
import json
import xmltodict
from io import BytesIO
from module.core.service.crawler import CrawlHandler
from ontology import Ontology, Document
from command import Command
from queue import Scanner
from error import *
class Mp4Handler(CrawlHandler):
def __init__(sel... | StarcoderdataPython |
4964575 | from . import RegexMatcher
# ------------------------------------------------------------------------------
# Main
# ------------------------------------------------------------------------------
if __name__ == "__main__":
import sys
def usage():
print(r"Usage: python -m vhdre <entity-name> <regex> .... | StarcoderdataPython |
241523 | import csv
import datetime
from django.utils.safestring import mark_safe
from django.contrib import admin
from django.http import HttpResponse
from .models import Employee, Customer, Assignment, Task, Leave
def export_to_csv(modeladmin, request, queryset):
opts = modeladmin.model._meta
response = HttpRespon... | StarcoderdataPython |
11321339 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Figure 1: Isotropic Hernquist DF.
Created: May 2021
Author: <NAME>
"""
import sys
import numpy as np
import matplotlib.pyplot as plt
import copy
from os.path import exists
sys.path.append("../src")
from constants import M_sun, kpc, G, pi
from hernquist im... | StarcoderdataPython |
3390624 | <reponame>Mathiasn21/Traffic_Sign_ML_final_project
import matplotlib.pyplot as plt
import numpy as np
from keras.layers import Conv2D, MaxPool2D, Dense, Flatten, Dropout
from keras.models import Sequential
from keras.utils import to_categorical
from sklearn.metrics import accuracy_score
from sklearn.model_selection imp... | StarcoderdataPython |
3475752 | <gh_stars>0
from app.controllers.get_all_class_descs import * # pylint: disable=C0413
from app.controllers.get_all_gyms import * # pylint: disable=C0413
from app.controllers.get_all_gymclasses import * # pylint: disable=C0413
from app.controllers.get_all_instructors import * # pylint: disable=C0413
from app.controllers... | StarcoderdataPython |
3299350 | <reponame>cahorn/tmonitor<filename>tmonitor/schedule.py
import datetime
import crontab
import re
cron = crontab.CronTab(user=True)
def add(args):
"""Add a new monitor poll to the schedule."""
# Construct monitor poll command
cmd_args = ['tmonitor']
for flag, arg in args.items():
if flag not in... | StarcoderdataPython |
3474588 | <filename>scripts/sensitivity_analysis/npi_leaveout.py
"""
:code:`npi_leaveout.py`
Leave our specified NPIs. Useful to study the sensitivity of the results to the inclusion of particular NPIs.
"""
import pymc3 as pm
from epimodel import EpidemiologicalParameters
from epimodel.preprocessing.data_preprocessor import p... | StarcoderdataPython |
5110645 | import pytest
import numpy as np
import pandas as pd
from marketcrush import strategies
@pytest.fixture(params=strategies.strategies.keys())
def strategy(request):
return strategies.strategies[request.param]
@pytest.fixture(params=[strategies.MACrossOverDayTrade,
strategies.TrendFollower... | StarcoderdataPython |
3512829 | <filename>test/test_phones.py<gh_stars>0
import re
from model.contact import Contact
def test_main_page_db(app, db):
contacts_from_home_page = sorted(app.contact.get_contact_list(), key=Contact.id_or_max)
contacts_from_db = sorted(db.get_contact_list(), key=Contact.id_or_max)
assert len(contacts_from_home_... | StarcoderdataPython |
4914704 | <filename>cards98/run_game_with_Qlearning.py
from game.cards98 import GameCards98
from reinforced.rl_agent import RLAgent
class Game(GameCards98):
def main_loop(self): # override
''' Main loop with game logic'''
while True:
self.hand_fill()
status, comment = self.end_condi... | StarcoderdataPython |
9724671 |
import os
import re
import fnmatch
from harmony import hashers
from harmony import serialization
from harmony.serialization import FileSerializable
class Ruleset(FileSerializable):
RELATIVE_PATH = 'rules'
_state = (
'rules',
)
class FileInfo:
pass
@classmethod
def init(clas... | StarcoderdataPython |
307122 | <filename>challenges/platformids.py
platforms = {
"UA": "usaco.org",
"CC": "codechef.com",
"EOL":"e-olimp.com",
"CH24": "ch24.org",
"HR": "hackerrank.com",
"HE": "hackerearth.com",
"ICPC": "icfpcontest.org",
"GCJ": "google.com/codejam",
"DE24": "deadline24.pl",
"IOI": "stats.ioinformatics.org",... | StarcoderdataPython |
100356 | <reponame>mv20100/phd_code
from PyDAQmx import *
import numpy as np
import ctypes, time
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
from collections import deque
class SyncAIAO(object):
compatibility_mode = 0 # Set this to 1 on some PC (Mouss)
trigName = "ai/StartTrigger"
... | StarcoderdataPython |
5128222 | <gh_stars>0
# testing spectral-net using data imported from xhm
# jianhong, 1/19
# %%
import pandas as pd
import numpy as np
import scipy.io as sio
import tensorflow as tf
import keras.backend as K
# %% load types
types = sio.loadmat('types.mat')
i2x = types['i2x']
# num
n = {}
n['i'] = len(i2x)
k = {}
k['i'] ... | StarcoderdataPython |
9641965 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
SkyAlchemy
Copyright ©2016 <NAME>
Licensed under the terms of the MIT License.
See LICENSE for details.
@author: <NAME>
"""
# Built-in imports
from __future__ import division, unicode_literals, print_function
import sys
import os
import os.path as osp
import subproce... | StarcoderdataPython |
1973896 | from dataclasses import dataclass
from bindings.ows.nil_value_type import NilValueType
__NAMESPACE__ = "http://www.opengis.net/ows/2.0"
@dataclass
class NilValue(NilValueType):
class Meta:
name = "nilValue"
namespace = "http://www.opengis.net/ows/2.0"
| StarcoderdataPython |
9740801 | # List of current season shows (fetched 12/30/2018).
#
# If any show on this list returns blank, the scraper is probably
# broken, and we should be noisy about it.
#
# curl -s https://horriblesubs.info/current-season/ | \
# grep -Po '/shows/[^"]+' | \
# sed 's:$:/:' | \
# while read show_url; do \
# ... | StarcoderdataPython |
3200482 | from collections import defaultdict
import mock
from searx.engines import soundcloud
from searx.testing import SearxTestCase
from searx.url_utils import quote_plus
class TestSoundcloudEngine(SearxTestCase):
def test_request(self):
query = 'test_query'
dicto = defaultdict(dict)
dicto['page... | StarcoderdataPython |
5167570 | <gh_stars>0
"""
setup_wizard template tags
==========================
Tags for including setup_wizard app javascript assets ina template. To use:
.. code-block:: html
{% load setup_wizard_tags %}
<!-- Render inclusion tag for frontend JS elements -->
{% setup_wizard_assets %}
"""
from __future__ import... | StarcoderdataPython |
3484692 | <reponame>etomteknoloji/charm-trove
# Copyright 2016 <NAME>.
#
# 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 ... | StarcoderdataPython |
376700 | '''
pi433.util
(c) <NAME>, 2017 [MIT License, see LICENSE]
Utility / helper functions
'''
import uuid
from gevent import socket
def byteify(str_input):
''' Recursively encode any `unicode` strings in `str_input` to utf-8
'''
if isinstance(str_input, dict):
return {byteify(key): byteify(value)
... | StarcoderdataPython |
3294646 | # -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. 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... | StarcoderdataPython |
9744709 | <filename>src/bgraph/utils.py<gh_stars>1-10
import functools
import logging
import pathlib
from bgraph.types import Dict, List, Any, Generator, Tuple, Callable, Union
def recurse(mapping: Dict[Any, Any]) -> Generator[Tuple[Any, Any], None, None]:
"""Recurse through a mapping and yield every key value pairs.
... | StarcoderdataPython |
1972109 | <reponame>sparkslabs/pyxie-bob
#
# Copyright 2016 British Broadcasting Corporation and Contributors(1)
#
# (1) Contributors are listed in the AUTHORS file (please extend AUTHORS,
# not this header)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance w... | StarcoderdataPython |
9652238 | <reponame>roadt/raspberryjammod-minetest<gh_stars>10-100
#
# Code under the MIT license by <NAME>
#
from mc import *
import text
import datetime
import time
import sys
import fonts
import ast
foreground = SEA_LANTERN # this needs Minecraft 1.8
background = AIR
def parseBlock(s):
try:
ret... | StarcoderdataPython |
5087564 | __docformat__ = "restructuredtext en"
import numpy
from theano.tests import unittest_tools as utt
from theano.tensor.raw_random import *
from theano.tensor import (raw_random, ivector, dvector, iscalar, dcol,
dtensor3)
from theano import tensor
from theano import compile, config, gof
clas... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.