id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
9650342 | import os
import torch.utils.data
import numpy as np
import torch.nn as nn
import torch.utils.data
import torch.optim as optim
import matplotlib.pyplot as plt
import DataPreprocessing as DP
from training import training
from Network import MLP, CNN, CNN2
DP.gpu_setting(gpu_num=0)
# hyper-parameter setting
learning... | StarcoderdataPython |
146482 | # import only necessary functions from modules to reduce load
from fdtd_venv import fdtd_mod as fdtd
from numpy import arange, array, where
from matplotlib.pyplot import subplot, plot, xlabel, ylabel, legend, title, suptitle, show, ylim, figure
from scipy.optimize import curve_fit
from os import path
from sys import ar... | StarcoderdataPython |
11203870 | import tensorflow as tf
import numpy as np
import datetime as time
# class for the core of the architecture
class GNN:
def __init__(self, net, input_dim, output_dim, state_dim, max_it=50, optimizer=tf.train.AdamOptimizer, learning_rate=0.01, threshold=0.01, graph_based=False,
param=str(time.datet... | StarcoderdataPython |
6471431 | # coding: utf-8
"""
Main window creation code.
"""
import sys
import gi
gi.require_version('Adw', '1')
gi.require_version('Gtk', '4.0')
from gi.repository import Adw, Gtk, Gio, GObject
from .views.assistant import AssistantContent # noqa: F401
from .views.skills import SkillsContent # noqa: F401
from .views.preferen... | StarcoderdataPython |
11349669 | <reponame>djfurman/aws_alb_serverless_status<filename>alb_response/responder.py
import json as py_json
from http import HTTPStatus
def alb_response(
http_status, data=None, json=None, headers=None, is_base64_encoded=False
):
response_headers = {}
status_code = HTTPStatus(http_status)
status_descript... | StarcoderdataPython |
6664487 | <filename>monorun/core/__init__.py
from .bbox_3d import *
from .evaluation import *
from .visualizer import *
| StarcoderdataPython |
3509259 | # -*- coding: utf-8 -*-
"""
GUI from tkinter
逻辑层
"""
# 设置GUI
root = Tk()
w = Label(root, text = "Guess Number Game")
w.pack()
# 欢迎消息
mb.showinfo("Welcome", "Welcome to Guess Number Game")
# 处理信息
number = 59
while True:
# 让用户输入信息:
guess = dl.askinteger("Number", "What's your guess?")
if guess == number:
... | StarcoderdataPython |
1711976 | """Loads All Image Resources"""
import os
import glob
from PySide6 import QtGui # pylint: disable=no-name-in-module # GitHub Actions cant import Qt modules
class ImageManager:
"""Loads Image Files
Attributes:
images (Dict{str: QtGui.QPixmap}): Dictionary of QPixmap objects
"""
def __init__(... | StarcoderdataPython |
3576155 | <filename>run.py
import cv2
def mail():
import time
import smtplib
from email.message import EmailMessage
Address = "27-17-43/1, Sector 12, <NAME>"
msg = EmailMessage()
msg["Subject"] = "Fire Outbreak Detected"
msg["From"] = "<EMAIL>"
msg["To"] = "<EMAIL>"
msg.set_conte... | StarcoderdataPython |
5094589 | <gh_stars>0
import calendar
from datetime import datetime, timedelta
WEEKDAY_NAME_LIST = list(calendar.day_name)
def add_time(start_time, duration, start_day_name=None):
# Parsing "start_time" parameter's hours and miniutes values and,
# creating datetime obj with those data.
parsed_start_datetime = da... | StarcoderdataPython |
1672975 | <reponame>ersilia-os/ersilia-automl-chem
from setuptools import setup, find_packages
with open("README.md", "r", encoding="utf8") as fh:
long_description = fh.read()
with open("requirements.txt") as f:
install_requires = f.read().splitlines()
install_requires += [
"melloddy_tuner @ git+git://githu... | StarcoderdataPython |
11360977 | <filename>marsyas-vamp/marsyas/src/qt5apps/MarGrid2/test-send-osc-to-margrid.py
#!/usr/bin/python
import osc
def myTest():
""" a simple function that creates the necesary sockets and enters an endless
loop sending and receiving OSC
"""
osc.init()
import time
i = 0
while 1:
i ... | StarcoderdataPython |
3361069 | <reponame>BillyDoo/scrumboard<gh_stars>0
# Generated by Django 2.2 on 2019-04-17 13:42
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('scrumboard', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='c... | StarcoderdataPython |
11336555 | """
Copyright 2022 RPANBot
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | StarcoderdataPython |
6647695 | <reponame>mithro/chromium-infra
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is govered by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""View objects to help display users and groups in UI templates... | StarcoderdataPython |
6690865 | class ShaderNodeLightFalloff:
pass
| StarcoderdataPython |
3294173 | <filename>triplinker/chat/views/all_views.py
# This module is needed to pass all functions(views) to the app's urls module.
# !Triplinker modules:
# Current app modules.
from chat.views.dialog_views.views import *
from chat.views.group_chat_views.views import *
| StarcoderdataPython |
9647310 | """
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM 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 ... | StarcoderdataPython |
3565840 | from typing import Optional, Union, Iterable, Sequence, Callable
from torch import Tensor
from torch.nn import ModuleList
from ..neko_module import NekoModule
from ..layer import Linear
from ..util import generate_inf_seq, ModuleFactory, compose
class MLP(NekoModule):
"""
The MLP module is a sequential modu... | StarcoderdataPython |
6440283 | <gh_stars>0
import sys
import time
import os
import subprocess
import string
import random
import jk_utils
import jk_mounting
from .AbstractBackupConnector import AbstractBackupConnector
from .ThaniyaIO import ThaniyaIO
from .ThaniyaBackupContext import ThaniyaBackupContext
from .utils.temp import writeTempFile
... | StarcoderdataPython |
12853024 | import common.assertions as assertions
def run(cfg):
assertions.validateAdminPassword(cfg) | StarcoderdataPython |
9799461 | <gh_stars>100-1000
# coding: utf-8
from __future__ import print_function
import os
# os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" # see issue #152
# os.environ["CUDA_VISIBLE_DEVICES"]="1"
from six.moves import xrange
import os
import tensorflow as tf
import numpy as np
import tensorflow.contrib.layers as ly
from t... | StarcoderdataPython |
4963667 | import boto3
import pytest
from tests.helper_functions import set_boto_credentials # pylint: disable=unused-import
from tests.sagemaker.mock import mock_sagemaker
@pytest.fixture
def sagemaker_client():
return boto3.client("sagemaker", region_name="us-west-2")
def create_sagemaker_model(sagemaker_client, mode... | StarcoderdataPython |
5145260 | <filename>string concordinate.py
a=str(input("Enter the first string: \n"))
b=str(input("Enter the second string; \n"))
print(a+" "+b)
| StarcoderdataPython |
1966911 | import random
import heapq
import datetime
import networkx as nx
import math
import argparse
import matplotlib.pyplot as plt
import time
import pickle
import numpy as np
import operator
save_dir = '../datasets/Flickr/'
dimension = 4
nodeDic = {}
edgeDic = {}
degree = []
G = pickle.load(open(save_dir... | StarcoderdataPython |
1638589 | import cv2
import numpy as np
before = cv2.imread('2.png')
b, g, r = cv2.split(before)
np.multiply(b, 1.5, out=b, casting="unsafe")
np.multiply(g, .75, out=g, casting="unsafe")
np.multiply(r, 1.25, out=r, casting="unsafe")
after = cv2.merge([b, g, r])
cv2.imshow('before', before)
cv2.imshow('after', after)
cv2.wait... | StarcoderdataPython |
6418362 | import copy
import itertools
from django import template
register = template.Library()
def previous_current_next(items):
"""
From http://www.wordaligned.org/articles/zippy-triples-served-with-python
Creates an iterator which returns (previous, current, next) triples,
with ``None`` filling in when th... | StarcoderdataPython |
1604846 | <gh_stars>1-10
import base64
import json
import platform
import sys
import uuid
from typing import Dict, List
import attr
import requests
from .version import __version__
@attr.s
class DbtRpcClient(object):
host: str = attr.ib(default="0.0.0.0")
port: int = attr.ib(validator=attr.validators.instance_of(int... | StarcoderdataPython |
4854806 | # Copyright 2015 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-2.0
#
# Unl... | StarcoderdataPython |
1873492 | from pydantic import BaseModel, Field, validator
class RegistrationModel(BaseModel):
login: str = Field(min_length=6)
password: str = Field(min_length=8)
@validator("login")
def validate_login(cls, login: str) -> str:
assert " " not in login, "No spaces allowed in login"
return login
... | StarcoderdataPython |
8015076 | <reponame>Algue-Rythme/GAT-Skim-Gram
import warnings
import numpy as np
import pygsp as gsp
from pygsp import graphs, filters, reduction
import scipy as sp
from scipy import sparse
from sortedcontainers import SortedList
from loukas_coarsening.maxWeightMatching import maxWeightMatching
import loukas_coarsening.graph_ut... | StarcoderdataPython |
8105612 | <reponame>mateuszmidor/sla_dashboard_webapp
from __future__ import annotations
import logging
from dataclasses import dataclass
from typing import Dict, Generator
from domain.geo import Coordinates
from domain.types import IP, AgentID
logger = logging.getLogger(__name__)
@dataclass
class Agent:
id: AgentID = A... | StarcoderdataPython |
262071 | # -*- coding: utf-8 -*-
import module
import fields
class FanActuator(module.Base):
update_rate = 10
public_name = 'Ventilateur'
class fan(fields.actuator.Fan, fields.syntax.Boolean, fields.io.Readable,
fields.persistant.Volatile, fields.Base):
public_name = 'État du ventilateur'
... | StarcoderdataPython |
281642 | from django.urls import path, include
from . import views
urlpatterns = [
path('location/', views.find_ahj_location, name='location'),
path('address/', views.find_ahj_address, name='address')
]
| StarcoderdataPython |
6691890 | import os
os.environ['NO_ET'] = '1'
| StarcoderdataPython |
25751 | <reponame>mbatchkarov/dc_evaluation
__author__ = 'mmb28'
import sys
sys.path.append('.')
sys.path.append('..')
sys.path.append('../..') | StarcoderdataPython |
3416021 | import os
from Game import Game
class LoadGame(Game):
def __init__(self, gamefolder):
self.gamefolder = os.path.abspath(gamefolder)
file = open(os.path.join(gamefolder, "sales"))
self.releaseplayers = int(file.readline().rstrip("\n").split(": ")[1])
file.close()
file = open(... | StarcoderdataPython |
6588883 | <filename>src/real_time.py
import threading
import time
from tkinter import *
from tkinter import ttk, messagebox
from tkinter.font import Font
import numpy
import seaborn as sns
import mne
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from pylsl import StreamInlet, resolve_stream
# htt... | StarcoderdataPython |
1919344 | import numpy as np
import itertools
# example from wikipedia
#a = [[-1,1],[3,2],[2,3],[-1,0],[0,-1]]
#b = [1,12,12,0,0]
# example from http://web.mit.edu/16.410/www/lectures_fall04/L18-19-IP-BB.pdf
a = [[6,3,5,2], [0,0,1,1], [-1,0,1,0], [0,-1,0,1], [1,0,0,0], [0,1,0,0],
[0,0,1,0], [0,0,0,1], [-1,0,0,0], [0,-1,0... | StarcoderdataPython |
3359710 | <filename>pyfeat/estimator/tram.py
r"""
======================
TRAM estimator wrapper
======================
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import pytram as pt
import numpy as np
class TRAM( object ):
r"""
I am the TRAM wrapper
"""
def __init__( self, C_K_ij, b_K_x, M_x, N_K_i ):
r""... | StarcoderdataPython |
9633886 | from likeapp.views import LikeSet
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'', LikeSet)
urlpatterns = router.urls
app_name = 'likeapp'
| StarcoderdataPython |
8063755 | # -*- coding: utf-8 -*-
"""
#Handling Missing Values in Pandas
* Tutorial: https://news.towardsai.net/hmv
* Github https://github.com/towardsai/tutorials/tree/master/pandas
"""
#Import Required Libraries:
import pandas as pd
#Raw data in form of dictionary:
info = {"Person":["Alan","Berta","Charlie","Danielle","Eule... | StarcoderdataPython |
4870240 | <gh_stars>10-100
"""This module contains functions for conversion of coordinates and file formats"""
# dependencies
from astropy.coordinates import SkyCoord
from astropy.table import Table
from astropy.io import fits
from astropy import units as u
import pandas as pd
def to_deg(coordinates):
"""Convert J2000 coo... | StarcoderdataPython |
11359782 | <filename>src/sniffmypacketsv2/transforms/session_2_ipaddr.py
#!/usr/bin/env python
from common.dbconnect import mongo_connect
from common.entities import pcapFile
from canari.framework import configure
from canari.maltego.entities import IPv4Address
from canari.maltego.message import UIMessage
from canari.config impo... | StarcoderdataPython |
6601793 | """
Django settings for password_generator project.
Generated by 'django-admin startproject' using Django 2.2.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
i... | StarcoderdataPython |
6572602 | <gh_stars>0
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from chirpstack_api.as_pb.external.api import gateway_pb2 as chirpstack__api_dot_as__pb_dot_external_dot_api_dot_gateway__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
class GatewayServiceS... | StarcoderdataPython |
9625114 | <filename>position/models.py
# position/models.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
# Diagrams here: https://docs.google.com/drawings/d/1DsPnl97GKe9f14h41RPeZDssDUztRETGkXGaolXCeyo/edit
from django.db import models
from election_office_measure.models import CandidateCampaign, MeasureCampaig... | StarcoderdataPython |
4883274 | def repeatedString(s, n):
L = len(s)
return (s.count('a') * (n//L) + s[:n % L].count('a'))
x = "abc"
n = 8
print(repeatedString("abc", 89)) | StarcoderdataPython |
179644 | import os, os.path, sys, wx, stat, shutil
import subprocess as sp
import traceback as tb
opj = os.path.join
global FILES_DIR, THUMB_DIR
MPLAYER_DIR = "mplayer" # change if needed
CONVERT_DIR = "convert" # imagemagick's convert
wx.InitAllImageHandlers()
def __GetThumbName(fullPath, fileType):
fileSize = os.... | StarcoderdataPython |
3454122 | import pandas as pd
import numpy as np
from scipy import stats
from ast import literal_eval
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.metrics.pairwise import linear_kernel, cosine_similarity
from surprise import Reader, Dataset, SVD, evaluate
from imdbToId import convert... | StarcoderdataPython |
11214941 | from keras.layers import Dense, Merge
from keras.models import Sequential
from keras.optimizers import RMSprop
from keras.regularizers import l2
from objectives import cca_loss
def create_model(layer_sizes1, layer_sizes2, input_size1, input_size2,
learning_rate, reg_par, outdim_size, use_all_singu... | StarcoderdataPython |
11335910 | <gh_stars>0
from convertmask import baseDecorate
import copy
import datetime
import os
import random
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element
import cv2
import numpy as np
import skimage
from convertmask.utils.auglib.optional.resize import resize_img
from convertmask.utils.img2xml.p... | StarcoderdataPython |
8061708 | empty_dictionary = {}
print(empty_dictionary)
empty_dictionary["key1"] = 20
print(empty_dictionary)
| StarcoderdataPython |
398761 | <reponame>Healthedata1/Flask-PL
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Invoice) on 2019-05-07.
# 2019, SMART Health IT.
from . import domainresource
class Invoice(domainresource.DomainResource):
""" Invoice conta... | StarcoderdataPython |
5016806 | #!usr/bin/env python
import os
import sys
######################################
# Command-line arguments
######################################
print(sys.argv)
# python reading_data.py first,second,3 ==> ['reading_data.py', 'first,second,3']
# python reading_data.py first, second, 3 ==> ['reading_data.py', 'first,'... | StarcoderdataPython |
1653331 | #!python
import logging
import sys
import traceback
from PyQt5.QtWidgets import QApplication
from hdfinspect.display.view import HDFInspectMain
def initialise_logging(default_level=logging.DEBUG):
global _log_formatter
_log_formatter = logging.Formatter(
"%(asctime)s [%(name)s:L%(lineno)d] %(levelna... | StarcoderdataPython |
11209324 | #!/usr/bin/env bash
#SBATCH --job-name=mlcommons-science-earthquake-a100
#SBATCH --output=mlcommons-science-earthquake-a100.out
#SBATCH --error=mlcommons-science-earthquake-a100.err
#SBATCH --partition=gpu
#SBATCH --cpus-per-task=6
#SBATCH --mem=32G
#SBATCH --time=06:00:00
#SBATCH --gres=gpu:a100:1
#SBATCH --account=d... | StarcoderdataPython |
4916421 | #!/usr/bin/env python
# _*_coding:utf-8_*_
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from handlers.base import engine
BaseModel = declarative_base()
# 新建表
def init_db():
BaseModel.metadata.create_all(engine)
# 删除表
def drop_db():
... | StarcoderdataPython |
8012189 | """
Python program to determine whether someone
has diabetes or not.
"""
#taking inputs
glucose_conc = int(input("Enter your glucose concentration: "))
#main working tree
if glucose_conc < 100:
bMi = int(input("Enter your BMI: "))
if bMi < 30:
Age = int(input("Enter your Age: "))
if Age < 31... | StarcoderdataPython |
3226349 | <reponame>IvLabs/udacity-self-driving-car<gh_stars>10-100
#parsing command line arguments
import argparse
#decoding camera images
import base64
#for frametimestamp saving
from datetime import datetime
#reading and writing files
import os
#high level file operations
import shutil
#matrix math
import numpy as np
#real-ti... | StarcoderdataPython |
9708190 | import csv
from django.core.management.base import BaseCommand
from operaQuizbot.helpers import facebook_get_json
from operaQuizbot.models import FacebookPage, OperaCategory
class Command(BaseCommand):
help = "Adds the operas from a CSV file."
def add_arguments(self, parser):
pass
def handle(s... | StarcoderdataPython |
8088523 | import numpy as np
import pandas as pd
from ploomber.testing import pandas as pd_t
def test_nulls_in_columns(tmp_directory):
df = pd.DataFrame({'x': np.random.rand(10), 'y': np.random.rand(10)})
df.to_csv('data.csv', index=False)
assert not pd_t.nulls_in_columns(['x', 'y'], 'data.csv')
df = pd.DataF... | StarcoderdataPython |
4801656 | <filename>usaspending_api/broker/helpers/delete_fabs_transactions.py
import logging
from usaspending_api.common.helpers.timing_helpers import timer
from usaspending_api.broker.helpers.delete_stale_fabs import delete_stale_fabs
from usaspending_api.broker.helpers.store_deleted_fabs import store_deleted_fabs
logger = ... | StarcoderdataPython |
5032012 | <reponame>psavery/HPCCloud
import os, time
from wslink import register as exportRpc
from paraview import simple, servermanager
from paraview.web import protocols as pv_protocols
from vtkmodules.vtkCommonCore import vtkUnsignedCharArray, vtkCollection
from vtkmodules.vtkCommonDataModel import vtkImageData
from vtkmod... | StarcoderdataPython |
6527458 | # encoding: utf-8
# pylint: disable=C0103
# pylint: disable=too-many-arguments
"""
Clustering
==========
Clustering and manifold learning
--------------------------------
.. autosummary::
:toctree: generated/
rhythmic_patterns
manifold_learning
"""
from sklearn import cluster
from sklearn import manifol... | StarcoderdataPython |
320264 | """
Sponge Knowledge Base
Processors metadata
"""
from org.openksavi.sponge.examples import PowerEchoMetadataAction
class UpperEchoAction(Action):
def onConfigure(self):
self.withFeatures({"visibility":False})
def onCall(self, text):
return None
def onLoad():
sponge.enableJava(... | StarcoderdataPython |
9622763 | <gh_stars>0
"""
Purpose:
Mapquest Helpers
This library is used to wrap mapquest API calls and handle authentication
"""
# Python Library Imports
import logging
import os
import re
import requests
###
# Properties
###
mapquest_api_headers = {
"accept": "text/html,application/xhtml+xml,appli... | StarcoderdataPython |
3410362 | # Generated by Django 3.0.7 on 2020-06-23 01:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('draft', '0002_auto_20200612_0522'),
]
operations = [
migrations.RenameField(
model_name='draft',
old_name='abstract',
... | StarcoderdataPython |
5093312 | <reponame>vilhelmprytz/Kanmail<filename>kanmail/version.py
import json
from functools import lru_cache
from os import path
from typing import Dict
from kanmail.settings.constants import CLIENT_ROOT
@lru_cache(maxsize=1)
def get_version_data() -> Dict[str, str]:
version_filename = path.join(CLIENT_ROOT, 'static'... | StarcoderdataPython |
197107 | # -*- coding: utf-8 -*-
from django.test import TestCase, RequestFactory
from django.test.utils import override_settings
from django.urls import reverse
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponseRedirect, HttpResponse
from django.conf import settings
from .. import middl... | StarcoderdataPython |
1886792 | __all__ = [
"cimac_id_to_cimac_participant_id",
"get_property",
"identity",
"MetadataModel",
"with_default_session",
]
from functools import wraps
from typing import Any, Dict, Optional, Tuple
from flask import current_app
from sqlalchemy.orm import Session
from ...config.db import BaseModel
# s... | StarcoderdataPython |
4841771 | # <NAME>
#This code integrates the 2 bhr files, but for those which don't have similar sameAs linke, but similar URI.
#the sameAs links are integrated into the new file
#30/04/2018
#Ver. 01
import rdflib
from rdflib import Namespace, URIRef, Graph , Literal
from SPARQLWrapper import SPARQLWrapper2, XML , RDF , JSON
fr... | StarcoderdataPython |
6575177 | <reponame>bcho/cached-property
# -*- coding: utf-8 -*-
"""
test_threaded_cache_property.py
----------------------------------
Tests for `cached-property` module, threaded_cache_property.
"""
from time import sleep
from threading import Thread, Lock
import unittest
from cached_property import threaded_cached_propert... | StarcoderdataPython |
135752 | n1 = int (input())
s1 = set(map(int,input().split()))
n2 = int (input())
s2 = set(map(int,input().split()))
print(len(s1.intersection(s2)))
| StarcoderdataPython |
6587014 | <reponame>risk-frontiers/OasisIntegration
import struct
import sqlite3
import os
import logging
import complex_model.DefaultSettings as DS
import time
"""
Implementation of ktool item/coverage/loss bin stream conversion tool including
complex item data serialized with msgpack.
"""
_DEBUG = DS.RF_DEBUG_MODE
if "RF_DEB... | StarcoderdataPython |
5190506 | import re
import os
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from urllib import urlencode
import csv
from product_spiders.items import Produc... | StarcoderdataPython |
4923580 | import os
import sys
import numpy as np
import open3d as o3d
import torch
import smplx
def update_render_cam(cam_param, trans):
### NOTE: trans is the trans relative to the world coordinate!!!
cam_R = np.transpose(trans[:-1, :-1])
cam_T = -trans[:-1, -1:]
cam_T = np.matmul(cam_R, cam_T) #!!!!!! T is ... | StarcoderdataPython |
302897 | # -*- coding: UTF-8 -*-
class CustomBaseException(Exception):
def __init__(self, prefix: str, arg: str, code: int, addition=""):
self._prefix = prefix
self._arg = arg
self._code = code
self._addition = addition
def __str__(self):
if not self._prefix == "":
... | StarcoderdataPython |
4944571 | queries = {
"postgresql": {
"table": """
SELECT
c.relname as "Name",
CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'm' THEN 'materialized view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' WHEN 'f' THEN 'foreign table' WHEN 'p' THEN 'par... | StarcoderdataPython |
12810854 | """
Quantifies the difference in occurrence of one
(or more mutations) between two sets of
isolates.
TODO:
1. Use DualDataProvider and implement getPoints locally so
have same data plotted as is analyzed
"""
from microbepy.common import constants as cn
from microbepy.common import util
from micro... | StarcoderdataPython |
5097925 | <reponame>brl0/bripy
from queue import Queue
from threading import Thread
from time import sleep
from bripy.bllb.logging import logger, DBG
def unloadq(q, stop, limit=2000, rest=.1, check=100):
i = limit
loops = 0
results = []
while True and ((i and not stop()) or q.qsize()):
loops += 1
... | StarcoderdataPython |
1854297 | # @lc app=leetcode id=640 lang=python3
#
# [640] Solve the Equation
#
# https://leetcode.com/problems/solve-the-equation/description/
#
# algorithms
# Medium (43.07%)
# Likes: 319
# Dislikes: 642
# Total Accepted: 30K
# Total Submissions: 69.5K
# Testcase Example: '"x+5-3+x=6+x-2"'
#
# Solve a given equation and... | StarcoderdataPython |
1950993 | <gh_stars>0
import argparse
import tools.find_mxnet
import mxnet as mx
import os
import sys
from train.train_net import train_net
def parse_args():
parser = argparse.ArgumentParser(description='Train a Single-shot detection network')
parser.add_argument('--dataset', dest='dataset', help='which dataset to use',... | StarcoderdataPython |
5079142 | <gh_stars>0
import csv
import shutil
import requests
from stationtz import AIRPORT_SOURCE_FILE, MANUAL_STATION_SOURCE_FILE
DATA_SOURCE_URL = 'https://raw.githubusercontent.com/opentraveldata/opentraveldata/master/opentraveldata/optd_por_public.csv'
def create_stations(file, **kwargs):
""" Manually specify stat... | StarcoderdataPython |
1985228 | <reponame>AlexandreSoaresValerio/Pycharm
t = int(input('Escolha uma tabuada:'))
for c in range(0, 11):
print('{} x {} = {}'.format(t, c, t*c))
| StarcoderdataPython |
6619690 | <reponame>jwbaldwin/novu-note
from django.test import TestCase
from django.contrib.auth.models import User
from rest_framework.test import APIClient
from rest_framework import status
from django.urls import reverse
from ..models import Note
class ViewTestCase(TestCase):
"""Test suite for the api views."""
de... | StarcoderdataPython |
9704033 | <filename>emergency_contact/models.py
from django.db import models
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
def validate_telepon(value):
if (not value.isdigit()):
raise ValidationError(
_('%(value)s bukan nomor telepon yang... | StarcoderdataPython |
227068 | # 形態素の解析結果格納用
class Morph():
def __init__(self, m_id, line):
self.id = 0 # 形態素のid
self.surface = "" # 形態素の表層
self.pos = "" # 品詞,品詞細分類1,品詞細分類2,品詞細分類3
self.pos1 = ""
self.pos2 = ""
self.pos3 = ""
self.pos4 = ""
self.base = "" # 基本形
self.re... | StarcoderdataPython |
8031694 | import sys
import tensorflow as tf
from time import time
from src.tftools.shift_layer import ShiftLayer
from src.tftools.scale_layer import ScaleLayer
from src.tftools.rotation_layer import RotationLayer
# from src.tftools.radial_distortion_layer import RDistortionLayer
# from src.tftools.radial_distortion_layer_2 impo... | StarcoderdataPython |
6623067 | <filename>zdiscord/service/integration/chat/discord/macros/General.py
from zdiscord.service.messaging.Events import IEvent
async def help_msg(help_msg: str,event: IEvent):
await event.context['message_object'].channel.send(help_msg) | StarcoderdataPython |
3566024 | # -*- coding: utf-8 -*-
"""
The parallel running version of APE.
To run APE in parallel through its API, first get a freq output file from Qchem, then call the .execute. For example:
ape = Parallel_APE(input_file)
ape.execute()
"""
import os
import csv
import time
import shutil
import numpy as np
import sub... | StarcoderdataPython |
1787017 | <reponame>Element-s/pyisync
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Created on 2015-9-14
@author: Elem
'''
import re
import time
import threading
import subprocess
from collections import deque
from pyinotify import WatchManager, ThreadedNotifier, \
ProcessEvent, ExcludeFilter, IN_DELETE, IN_CREATE, \... | StarcoderdataPython |
8070797 | """ CLI for Ray Tracer Challenge
"""
def cli():
pass
| StarcoderdataPython |
26970 | <filename>sendmail.py
import smtplib, ssl
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
SMTP_URL = "example.com"
def send_verification_code(recipient, recipient_name, verification_code):
sender_email = "<EMAIL>"
with open('.smtp_passwd') as password_file:
... | StarcoderdataPython |
11350543 | <reponame>fullstack-lumberjack/lumberjack<gh_stars>1-10
#!/usr/bin/env python3
import sys
from easy_table import EasyTable
myTable = EasyTable
myTable.setTableCorners("/", "\\", "/", "\\")
myTable.setTableBorder("|", "-")
myTable.setTableInnerStructure("|", "-", "+")
myTable.setColumns(["ID #", "Name", "Age"])
data ... | StarcoderdataPython |
5043718 | <reponame>lw0/dfaccto<filename>cfg/tb_streamtest.py<gh_stars>0
Inc('sim.py', abs='sim')
Inc('streamtest.py')
with EntTestbench(
SimPort.Sys('sys', T('Sys', 'dfaccto')),
SimPort.Source('stmSrc', T('LongStream')),
SimPort.Sink('stmBufIn', T('LongStream')),
SimPort.Source('stmBufOut', T('LongStream')),
... | StarcoderdataPython |
4832330 | <reponame>daniktl/task-scheduler-put-project<filename>tests/test_machine.py<gh_stars>1-10
from task_scheduler.machine import *
from task_scheduler.task import *
import random
def test_machine_basic(test_machine: Machine):
assert test_machine.speed == 1.2
def test_machine_tasks(test_machine: Machine):
assert... | StarcoderdataPython |
3301031 | "`fastai.layers` provides essential functions to building and modifying `model` architectures"
from .torch_core import *
__all__ = ['AdaptiveConcatPool2d', 'CrossEntropyFlat', 'Debugger', 'Flatten', 'Lambda', 'PoolFlatten', 'ResizeBatch',
'StdUpsample', 'bn_drop_lin', 'conv2d', 'conv2d_relu', 'conv2d_trans... | StarcoderdataPython |
166180 | <reponame>GiantTreeLP/porth-jvm
from jawa.assemble import Label
from jawa.attributes.bootstrap import BootstrapMethod, BootstrapMethodsAttribute
from jawa.constants import MethodHandleKind
from extensions.DeduplicatingClassFile import DeduplicatingClassFile
from jvm.intrinsics import OperandType
from jvm.intrinsics.st... | StarcoderdataPython |
5149077 | <reponame>pbipin/amicable_numbers
"""
Author: <NAME>. (mailto: <EMAIL>)
http://iambipin.com
101010101 10 101010101 10 101 10 101010101
1010101010 10 1010101010 10 1010 10 1010101010
10 101 10 10 101 10 10 01 10 10 101
10 101 10 10 101 10 10 10 1... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.