id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
119795 | from django.contrib import admin
from .models import Image,UserProfile
admin.site.register(Image)
admin.site.register(UserProfile)
# Register your models here.
| StarcoderdataPython |
130257 | #! /usr/bin/env python
# Author: <NAME> (jewett.aij at g mail)
# License: 3-clause BSD License (See LICENSE.TXT)
# Copyright (c) 2017, California Institute of Technology
# All rights reserved.
"""
This standalone python script can be used to convert force-field data
in FRC files (a.k.a. "MSI", "Accelrys", "BIOSYM", ... | StarcoderdataPython |
24845 | from django.shortcuts import render
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import status, permissions
import pyotp
import base64
from rest_framework_simplejwt.tokens import RefreshToken
from .serializers import CustomUserSerializer
from .models import ... | StarcoderdataPython |
3384902 | def maxProfit(prices):
"""
:type prices: List[int]
:rtype: int
"""
total = 0
for i in range(len(prices) - 1):
total += max(prices[i + 1] - prices[i], 0)
return total
Input = [7,1,5,3,6,4]
print(maxProfit(Input))
# Output: 7
# Explanation: Buy on day 2 (price = 1) and se... | StarcoderdataPython |
13357 | <gh_stars>1-10
import logging
from iptv_proxy.providers.beast.constants import BeastConstants
from iptv_proxy.providers.iptv_provider.json_api import ProviderConfigurationJSONAPI
logger = logging.getLogger(__name__)
class BeastConfigurationJSONAPI(ProviderConfigurationJSONAPI):
__slots__ = []
_provider_nam... | StarcoderdataPython |
1757630 | __author__ = 'noam'
import os
import cv2
import numpy as np
from matplotlib import pyplot as plt
lefthand = cv2.imread('noam_left_hand_30.5.15_02062015_0001.png')
lefthand_imgray = cv2.cvtColor(lefthand,cv2.COLOR_BGR2GRAY)
small = cv2.resize(lefthand_imgray, (0, 0), fx=0.5**6, fy=0.5**6)
small = cv2.resize(small, ... | StarcoderdataPython |
1617877 | # Created by MechAviv
# Quest ID :: 17619
# [Commerci Republic] Come Back Here!
sm.setSpeakerID(9390217)
sm.sendNext("I can't believe it. All those items... stolen! And the iron I ordered was in there, too.")
sm.setSpeakerID(9390217)
sm.setPlayerAsSpeaker()
sm.sendSay("Hey, Tepes!")
sm.setSpeakerID(9390217)
sm.sen... | StarcoderdataPython |
1662399 | import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Lipinski
from rdkit.Chem import Descriptors
from rdkit.DataStructs import FingerprintSimilarity, ConvertToNumpyArray
def clean_mol(smiles):
"""
Construct a molecule from a SMILES string, removing stereochemistry and... | StarcoderdataPython |
3281407 | <filename>p_collaboration_and_competition/MADDPG.py
import numpy as np
import random
import copy
from collections import namedtuple, deque
import torch
import torch.optim as optim
import torch.nn.functional as F
from model import Actor, Critic
seed = 0
BUFFER_SIZE = int(1e5) # replay buffer size
BATCH_SIZE = 250 ... | StarcoderdataPython |
135292 | <reponame>elliottwaissbluth/tensor-hero<filename>Shared_Functionality/Preprocessing/Archive/music2array.py
# Import relevant libraries
# scipy is a signals processing toolkit
# pydub lets you import mp3 files as numpy arrays
# https://www.filehorse.com/download-ffmpeg-64/download/ -> to get ffmpeg
# https://www.you... | StarcoderdataPython |
36320 | <filename>Histogram_Equalization/equalizer.py
#This code is a practice on Histogram Equalization
#Coded by: CSEMN (<NAME> - Sec 4)
#Supervised by: Dr.<NAME>
__author__ = '<NAME>'
from tkinter import *
from tkinter import ttk
import cv2 as cv # if not installed please consider running : pip install opencv-python
from PI... | StarcoderdataPython |
1683494 | <filename>Lan.py<gh_stars>0
#!/usr/bin/python3
import os
import requests
import glob
import sys
import string
BLUE = '\033[94m'
RED = '\033[91m'
ENDC = '\033[0m'
def requesting(namestring):
try:
p = requests.get("http://43.241.202.33:3000/i18n/" + namestring + ".json")
if "<!DOCTYPE html>"not in p.text:
#mea... | StarcoderdataPython |
3202993 | <gh_stars>1-10
#!/usr/bin/env python3
from __future__ import division, print_function
import sys
import numpy
import gym
import time
from optparse import OptionParser
import gym_minigrid
def main():
parser = OptionParser()
parser.add_option(
"-e",
"--env-name",
dest="env_name",
... | StarcoderdataPython |
3346152 | <filename>singlecellmultiomics/molecule/iterator.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from singlecellmultiomics.molecule import Molecule
from singlecellmultiomics.fragment import Fragment
from singlecellmultiomics.utils.prefetch import initialise_dict, initialise
from singlecellmultiomics.universalBamTagger... | StarcoderdataPython |
33524 | #
# GADANN - GPU Accelerated Deep Artificial Neural Network
#
# Copyright (C) 2014 <NAME> (<EMAIL>)
#
# 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 w... | StarcoderdataPython |
74392 | <reponame>hirnimeshrampuresoftware/python-tcod
"""Tileset and font related functions.
Tilesets can be loaded as a whole from tile-sheets or True-Type fonts, or they
can be put together from multiple tile images by loading them separately
using :any:`Tileset.set_tile`.
A major restriction with libtcod is that all tile... | StarcoderdataPython |
3251460 | <filename>clients/python-flask/generated/openapi_server/controllers/security_controller_.py
from typing import List
def info_from_jenkins_auth(username, password, required_scopes):
"""
Check and retrieve authentication information from basic auth.
Returned value will be passed in 'token_info' parameter of... | StarcoderdataPython |
3362100 | <filename>HW4/submission/PART II/code/main_task21.py
import numpy as np
from graph_cut import *
from itertools import combinations
def get_pairwises(adj):
n = np.size(adj, 0)
pairs = combinations([i for i in range(0, n)], 2)
edge_relations = []
for i, j in pairs:
edge_relations.append([i, j, 0... | StarcoderdataPython |
3210565 | import math
from keras import activations, layers, initializers
from keras.utils.generic_utils import register_keras_serializable
from keras.utils.tf_utils import shape_type_conversion
@register_keras_serializable(package='TFVan')
class MLP(layers.Layer):
def __init__(self, ratio, dropout, **kwargs):
supe... | StarcoderdataPython |
1711961 | <filename>code/NN_analysis_script2.py
#!/usr/bin/python
import getopt
import sys
import pickle
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import kmeans
import cluster_stats as cs
import analysis as a
import develop as d
## Analysis script!
## This does not run kmeans or ... | StarcoderdataPython |
1743406 | <filename>hivprotmut/filters/sequences/test/TestSequenceFilters.py
'''
Created on 25/8/2014
@author: victor
'''
import unittest
from hivprotmut.filters.sequences.filters import ExactlyThisLengthFilter,\
NoGapsFilter, SequenceAlignmentFilter
class TestSequenceFilters(unittest.TestCase):
def test_nogap_filter... | StarcoderdataPython |
112586 | <filename>pychain.py
# -*- coding: utf-8 -*-
from hashlib import sha256
import json
from time import time
class Block:
def __init__(self, timestamp=None, data=None):
self.timestamp = timestamp or time()
self.data = [] if data is None else data
self.prevHash = None
self.nonce = 0
... | StarcoderdataPython |
1616815 | #!/usr/bin/env python3
"""
Polyglot v2 node server for Davis WeatherLink Weather Station data.
Copyright (c) 2020 <NAME>
"""
import polyinterface
import sys
import time
import datetime
import json
import math
import node_funcs
from nodes import uom
LOGGER = polyinterface.LOGGER
@node_funcs.add_functions_as_methods(no... | StarcoderdataPython |
1683396 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `color_bucket_logger` package."""
import logging
import logging.config
import sys
import threading
import logging_tree
import pytest
try:
from logging import NullHandler
except ImportError:
# no NullHandler on py2.6, so use our own
class NullHand... | StarcoderdataPython |
1706361 | <gh_stars>10-100
text = """
//------------------------------------------------------------------------------
// Explicit instation.
//------------------------------------------------------------------------------
#include "Geometry/Dimension.hh"
#include "DataBase/StateBase.cc"
namespace Spheral {
template class Sta... | StarcoderdataPython |
3322089 | <gh_stars>0
from requests_html import HTML
from lol_scrapers.utils import src2https, ROLES
from lol_scrapers.utils.dataclasses.champion import Champion
from lol_scrapers.utils.abc.scraper_strategy import ScrapeStrategy
class ChampionScraper(ScrapeStrategy):
def scrape(self, champion_html: HTML):
"""Scra... | StarcoderdataPython |
3226825 | import unittest, random, sys, time
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_exec as h2e, h2o_hosts, h2o_import as h2i
zeroList = [
'Result.hex = Result0 = c(0)',
'Result.hex = Result = c(0)',
]
# randomBitVector
# randomFilter
# factor
# bug?
exprList = [
... | StarcoderdataPython |
3213349 | <filename>ALGORITHMS/Greedy/Fractional_Knapsack/Fractional-Knapsack.py
# Uses python3
# A thief finds much more loot than his bag can fit. Help him to find the most valuable combination of items assuming that any fraction of a loot item can be put into his bag.
#This provides solution to the Greedy Algorithm problem ca... | StarcoderdataPython |
26849 | def hsd_struct_beh(mode_1, mode_2, LEDs, LED_rdy_en, LED_rdy_buff, LED_rdy_out, DELAY_BITS, BUFFER_SIZE):
'''|
| Specify the behavior, describe data processing; there is no notion
| of clock. Access the in/out interfaces via get() and append()
| methods. The "hsd_struct_beh" function does not return val... | StarcoderdataPython |
1734825 | #!/usr/bin/python3
# Author: <NAME> (<EMAIL>)
# This script runs automated tests on a set of Android applications.
import os
import sys
import time
import argparse
import subprocess
import shutil
###############################################################################
# Common functions
######################... | StarcoderdataPython |
3335914 | from flask import Blueprint, render_template, redirect, url_for, request, flash, Response, _app_ctx_stack
from flask_table import Table, Col, ButtonCol
import docker
from .utils import otp_required, ModalCol, Modal2Col
container = Blueprint('container', __name__)
def flask_logger(containerid):
"""creates logging ... | StarcoderdataPython |
3293533 | import argparse
import gzip
import json
import elasticsearch
from elasticsearch_dsl import Search
import tqdm
def main():
parser = argparse.ArgumentParser(description='Download items from ES index')
arg = parser.add_argument
arg('output', help='output in .jl.gz format')
arg('index', help='ES index na... | StarcoderdataPython |
1725528 | <reponame>drrobotk/multilateral_index_calc<filename>src/PriceIndexCalc/pyspark_modules/helpers.py
from pyspark.sql import (
functions as F,
Column as SparkCol,
)
from pyspark.sql.window import Window
__author__ = ['Dr. <NAME>']
def _weights_calc_pyspark(
price_col: str = 'price',
quantity_col: str = '... | StarcoderdataPython |
1675290 | import argparse
import numpy as np
import torch
import os.path as osp
import matplotlib.pyplot as plt
from mmdet import cv_core
from mmdet.cv_core import Config
from mmdet.datasets.builder import build_dataset, build_dataloader
def parse_args():
parser = argparse.ArgumentParser(description='Browse a dataset')
... | StarcoderdataPython |
3216720 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 20 11:25:28 2019
@author: arpan
@Description: Generate feature vector labels and save to target folder
"""
import numpy as np
import os
import json
# Local Paths
LABELS = "/home/arpan/VisionWorkspace/Cricket/scripts/supporting_files/sample_set_... | StarcoderdataPython |
193791 | <filename>samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the ... | StarcoderdataPython |
1751486 | <filename>model/DAM/util.py
"""Model util ops and modules."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
def batch_invert_permutation(permutations):
"""Returns batched `tf.invert_permutation` for every r... | StarcoderdataPython |
1763159 | <gh_stars>10-100
from __future__ import division
import math
import random as rd
import networkx as nx
import numpy as np
from pysbm import sbm
class NetworkSuppplier(object):
""" Create different types of graphs"""
STANDARD_SEED = 42
def __init__(self):
self.partition_class = sbm.NxPartition
... | StarcoderdataPython |
18348 | <reponame>alexandru-m-g/hdx-ckan
'''
Sitemap plugin for CKAN
'''
from ckan.plugins import implements, SingletonPlugin
from ckan.plugins import IRoutes
class SitemapPlugin(SingletonPlugin):
implements(IRoutes, inherit=True)
def before_map(self, map):
controller='ckanext.sitemap.controller:SitemapContr... | StarcoderdataPython |
3259856 | #importando tkinter
from tkinter import *
from tkinter import ttk
#cor
cor1 = "#0a0a0a" #preta
cor2 = "#feffff" #branca
cor3 = "#223e6b" #Azul carregado
cor4 = "#8a8380" #Cinza
cor5 = "#f2743a" #laranja
#janela base
janela = Tk()
janela.title("Calculadora")
janela.geometry("235x310")
janela.config(bg=cor1)
#fr... | StarcoderdataPython |
92701 | # Aula 24 - Desempacotamento de listas em Python
lista = ['Luiz', 'João', 'Maria', 'Marcos', 'Julia']
n1, n2, n3, n4, n5 = lista # A quantidade variveis tem que ser igual ao quantidad de elementos
print(n2)
v1, *outraLista, ultimoLista = lista # O restante dos valores da lista vai para uma nova lista, precisa us... | StarcoderdataPython |
4807241 | <filename>ui/migrations/0008_video_statuses.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-08-15 19:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("ui", "0007_collections"),
]
operatio... | StarcoderdataPython |
119843 | <reponame>ossteam8/oss8_proj<gh_stars>1-10
from django.shortcuts import render
from django.views.generic.detail import DetailView
from crawling.models import Article
# # -*- coding: cp949 -*-
import platform
import kss
import numpy as np
from functools import partial
from sklearn.preprocessing import normalize
from ... | StarcoderdataPython |
1649584 | <reponame>simbilod/gdsfactory
import gdsfactory as gf
from gdsfactory.tech import LAYER
@gf.cell
def test_path_extrude_multiple_ports() -> gf.Component:
s = gf.Section(
width=2.0,
offset=-4,
layer=LAYER.HEATER,
port_names=["e1", "e2"],
port_types=("electrical", "electrical"... | StarcoderdataPython |
3379136 | <reponame>JoZimmer/ParOptBeam<filename>source/auxiliary/global_definitions.py
AVAILABLE_BCS = ['\"fixed-fixed\"', '\"pinned-pinned\"', '\"fixed-pinned\"',
'\"pinned-fixed\"', '\"fixed-free\"', '\"free-fixed\"']
BC_DOFS = {
'2D': {'\"fixed-fixed\"': [0, 1, 2, -3, -2, -1],
'\"pinned-pinne... | StarcoderdataPython |
1663555 | from pgfutils import save, setup_figure
setup_figure(width=0.95, height=0.4)
from matplotlib import pyplot as plt
import numpy as np
noise = np.random.randn(512, 256)
plt.imshow(noise, interpolation="nearest", aspect="auto")
plt.colorbar()
save()
| StarcoderdataPython |
3207781 | """ Classic socket client module """
import socket
from threading import Thread
from smserver.smutils import smconn
class SocketConn(smconn.StepmaniaConn, Thread):
ENCODING = "binary"
def __init__(self, serv, ip, port, conn):
Thread.__init__(self)
smconn.StepmaniaConn.__init__(self, serv, ip... | StarcoderdataPython |
1684374 | import logging
import pandas as pd
import glob
import os
import sys
utils_path = os.path.join(os.path.abspath(os.getenv('PROCESSING_DIR')),'utils')
if utils_path not in sys.path:
sys.path.append(utils_path)
import util_files
import util_cloud
import util_carto
import requests
from zipfile import ZipFile
import urll... | StarcoderdataPython |
4839205 | """aws_lambda_logging tests."""
import io
import json
import logging
from pytest import fixture, mark, yield_fixture
from aws_lambda_powertools.logging.aws_lambda_logging import setup
@fixture
def stdout():
return io.StringIO()
@fixture
def handler(stdout):
return logging.StreamHandler(stdout)
@fixture
... | StarcoderdataPython |
1606897 | <reponame>wlonk/env-excavator
__version__ = '1.5.0'
from .utils import ( # NOQA
env_string,
env_bool,
env_list,
env_int,
env_float,
env_timestamp,
env_iso8601,
get,
)
| StarcoderdataPython |
3327410 | # Copyright 2022 SURF.
# 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, ... | StarcoderdataPython |
3330866 | <filename>tests/test_mnist_dask.py<gh_stars>1-10
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torchvision import datasets, transforms
from torch.utils.data import Subset
import numpy as np
from distributed.utils_test import gen_cluster
from adadamp import DaskBase... | StarcoderdataPython |
1733797 | """
"""
from typing import Any, Union
from starlette.requests import Request
from starlette.responses import JSONResponse
from starlette.status import (
HTTP_400_BAD_REQUEST
)
from fastapi.exceptions import RequestValidationError, HTTPException
class BadRequestException(HTTPException):
def __ini... | StarcoderdataPython |
1630059 | #
# ICRAR - International Centre for Radio Astronomy Research
# (c) UWA - The University of Western Australia
# Copyright by UWA (in the framework of the ICRAR)
# All rights reserved
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General... | StarcoderdataPython |
1623636 | import rematbal.matbal as mb
import numpy as np
from scipy.optimize import fsolve
import pandas as pd
def mbal_inner_calc(dict, P, Pres_calc, We, aquifer_pres, step):
Np, Wp, Gp, N, Wei, pvt_oil_pressure, pvt_oil_Bo, pvt_oil_Bg, pvt_oil_Rs, Rsb, \
Bti, Bgi, Pi, m, Boi, cw, Swi, cf, Rsi, Bw, Winj, Bwinj, Ginj, ... | StarcoderdataPython |
1667194 | <gh_stars>1-10
import math
def summation(n):
if n == 1:
return 1
if n < 1:
return 0
m = math.floor((math.sqrt(2) - 1) * n)
return (m * n) + (n * (n + 1) / 2) - (m * (m + 1) / 2) - summation(m)
def solution(s):
s = int(s)
return str(int(summation(s)))
print(solution(... | StarcoderdataPython |
165410 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
A script to parse The Lord of the Rings: The Fellowship of the Ring.
Input file: the-fellowship-of-the-ring.txt
"""
import os
import codecs
import re
# Set the working directory.
os.chdir(r".\datasets\the_lord_of_the_rings")
# Read the script line by line.
def read_script(... | StarcoderdataPython |
105030 | from .device_address_pb2_grpc import *
from .device_address_pb2 import *
from .device_pb2_grpc import *
from .device_pb2 import *
from .lorawan_pb2_grpc import *
from .lorawan_pb2 import *
| StarcoderdataPython |
3355369 | <reponame>ReddyLab/cegs-portal
# Generated by Django 3.2.9 on 2021-11-19 16:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('search', '0018_auto_20211119_1053'),
]
operations = [
migrations.AddField(
model_name='experiment... | StarcoderdataPython |
107514 | <gh_stars>100-1000
import json
from functools import wraps
import time_uuid
from constants import INDEXED, LEADER_NOT_READY,\
ERROR_LIST_ALL_FILES, LEADER,\
HASH_DUMP, FILE_SYS_EVENT, SEARCH_REQ, SEARCH_RES, \
LOOKUP, IWANT_PEER_FILE, PEER_LOOKUP_RESPONSE,\
SEND_PEER_DETAILS, FILE_DETAILS_RESP, INIT_FIL... | StarcoderdataPython |
3236212 | <gh_stars>10-100
"""
Solution provided by <NAME>
"""
from datetime import datetime
date_time = datetime(2020, 3, 8)
date_string = datetime.strftime(date_time, "%A, %-d %B %Y")
print(date_string)
| StarcoderdataPython |
3204156 | """
Script to prepare log-normal mock data tables for regression
"""
import sys
import os
import fitsio as ft
import numpy as np
import healpy as hp
import lssutils.utils as utils
# read mock
mock_path = sys.argv[1]
output_path = sys.argv[2]
region = sys.argv[3] #"bmzls"
print(f"input mock: {mock_path}")
print(f"... | StarcoderdataPython |
3374870 | import unittest
import os
from datetime import date
from bs4 import BeautifulSoup
from tests.test_abs_parser import ABS_FILES
from browse.services.document.metadata import AbsMetaSession
from browse.domain.license import ASSUMED_LICENSE_URI
from browse.services.util.external_refs_cits import include_inspire_link, \
... | StarcoderdataPython |
1773812 | <reponame>superrrpotato/Defending-Neural-Backdoors-via-Generative-Distribution-Modeling
import torch
import torchvision
import numpy as np
import copy
import os
from . import resnet
from .result import Result
from .general import *
class Model:
def __init__(self, dataset_name, model_path=''):
self.name = d... | StarcoderdataPython |
1715000 | <gh_stars>1-10
import numpy as np
from datasets import load_metric
try:
from evaluation.benchmark import Benchmark
except:
from benchmark import Benchmark
from nltk import word_tokenize
import matplotlib.pyplot as plt
import seaborn as sns
from tqdm import tqdm
def plot_tau_function_of_num_passages(predic... | StarcoderdataPython |
125103 | from datetime import datetime, timedelta, time
from flask import current_app
from app.extensions import db
from app.data_analysis.models import DailyOEE
from app.default.models import Activity, ActivityCode, ScheduledActivity, MachineGroup
from app.default.db_helpers import get_machine_activities, get_user_activities... | StarcoderdataPython |
1701211 | #!/usr/bin/env python3
import argparse
import enum
import logging
import os
import subprocess
log = logging.getLogger(__name__)
class Run(enum.Enum):
Benders = 1
Test = 2
Train = 3
class Config:
def __init__(self, cplex_lib_path, instance, jar_path, model, num_delays,
path, run_ty... | StarcoderdataPython |
3299728 | <gh_stars>1-10
import unittest
from pyspark import RDD
from pyspark.sql.tests import ReusedSQLTestCase
class FiltersTestCase(ReusedSQLTestCase):
def test_filters(self):
# test code comes here
def begins_with_o(word):
if word.startswith("o"):
return word, # single ele... | StarcoderdataPython |
3252973 | <reponame>king2b3/ga_learn
"""es.py
Developer: <NAME>
Date: 2-26-2022
Description: Evolutionary Strategy framework
"""
################################## Imports ###################################
import individual as indv
import random
##########################################################################... | StarcoderdataPython |
3251273 | import logging
from ..service_model import Service, Project
from .xmlrpc import ConfluenceXMLRPC
l = logging.getLogger(__name__)
class Confluence(Service):
# TODO: get version from API
# TODO: include option to exclude private spaces (and do that by default?)
name = 'Confluence'
space_permissions_s... | StarcoderdataPython |
16879 | """The solaredge integration."""
from __future__ import annotations
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from .const import DOMAIN
CONFIG_SCHEMA = cv.deprecated(DOMAIN)
async def async_setup_entry(hass... | StarcoderdataPython |
3290774 | <reponame>oudalab/phyllo
import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
from phyllo.phyllo_logger import logger
# functions are mostly made by <NAME>
def add_to_database(verse_entries, db):
logger.info("Adding {} entries to the database".format(len(verse_en... | StarcoderdataPython |
1669042 | <reponame>slevi123/bacalaureat
from models import Substantiv, Verb, StructAlt
cuvinte_din_ib = [
[Substantiv,
lambda cuvant:cuvant["singular"]["nume"],
"search_value",
[
{"singular": {"nume": "peisaj", "nev": ""}},
{"singular": {"nume": "călător", "nev": ""}},
... | StarcoderdataPython |
42326 | <filename>examples/highfreq/highfreq_ops.py<gh_stars>1000+
import numpy as np
import pandas as pd
import importlib
from qlib.data.ops import ElemOperator, PairOperator
from qlib.config import C
from qlib.data.cache import H
from qlib.data.data import Cal
from qlib.contrib.ops.high_freq import get_calendar_day
class D... | StarcoderdataPython |
170530 | <filename>openGaussBase/testcase/SQL/FULL_TEXT_SEARCH/text_search/Opengauss_Function_Text_Search_Case0007.py
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan ... | StarcoderdataPython |
91406 | <gh_stars>0
__author__ = '<NAME><<EMAIL>>'
from mozi_cross_val.filters.base_filter import BaseFilter
class AccuracyFilter(BaseFilter):
def cut_off(self, models, value):
return list(filter(lambda k : k.train_score.accuracy - k.test_score.accuracy <= value, models))
class PrecisionFilter(BaseFilter):
... | StarcoderdataPython |
1780019 | <filename>src/views.py<gh_stars>0
from flask import Flask, jsonify, request
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import Column, Integer, String, Float
from flask_marshmallow import Marshmallow
from flask_jwt_extended import JWTManager, jwt_required, create_access_token
from flask_mail import Mail, Me... | StarcoderdataPython |
1782042 | """Update pings table
Revision ID: 85ea2d438ac8
Revises: 414529b77ea3
Create Date: 2019-01-29 00:08:10.292623
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '85ea2d438ac8'
down_revision = '414529b77ea3'
branch_labels =... | StarcoderdataPython |
116530 | import os
import re
import hashlib
import subprocess
from filecmp import cmp
from rdkit.Chem import AllChem
from minedatabase import pickaxe
from minedatabase.databases import MINE
data_dir = os.path.dirname(__file__)+'/data'
def purge(directory, pattern):
for f in os.listdir(directory):
if re.search(pa... | StarcoderdataPython |
157408 | import os
import torch
from torch import nn, tensor
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks.early_stopping import EarlyStopping
from torch.utils.data import DataLoader, TensorDataset
from sklearn.datasets import load_boston, fetch_california_housing
from sklearn.model_selection import tra... | StarcoderdataPython |
10933 | <reponame>acocac/scivision-test-plugin
from .model import DummyModel, ImageNetModel
| StarcoderdataPython |
3288145 | <filename>StanfordQuadruped/pupper/MovementGroup.py
from src.MovementScheme import Movements
def appendDanceMovement():
#demo 1
dance_scheme = Movements('stand','AttitudeDisable','ActuatorDisable')
dance_scheme.setMovementExitState('Stand')
dance_all_legs = []
dance_all_legs.append([... | StarcoderdataPython |
3269467 | <reponame>natewong1313/recaptcha-fullauto<filename>src/utils.py
from loguru import logger
import random
import time
import os
def sleep_random(min_time, max_time):
delay = random.uniform(min_time, max_time)
logger.debug(f"Sleeping for {delay} seconds")
time.sleep(delay)
def load_proxy():
wi... | StarcoderdataPython |
3347210 | <reponame>lukaszlaszuk/insightconnect-plugins<gh_stars>10-100
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Query billing address info"
class Input:
ADDRESS = "address"
BILLING_ADDRESS = "billing_address"
BILLING_ADDRESS_2 = "billing_address_2"
... | StarcoderdataPython |
1646857 | <filename>sdk/python/pulumi_azure_native/managedidentity/__init__.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from .. import _utilities
import typing
# Export this package's modules as members... | StarcoderdataPython |
2062 | <filename>course-code/imooc-tf-mnist-flask/mnist/module.py
import tensorflow as tf
# y=ax+b linear model
def regression(x):
a = tf.Variable(tf.zeros([784, 10]), name="a")
b = tf.Variable(tf.zeros([10]), name="b")
y = tf.nn.softmax(tf.matmul(x, a) + b)
return y, [a, b]
# 定义卷积模型
def convolutional(x, ... | StarcoderdataPython |
1607856 | <reponame>SmritiSatyanV/flyteidl
# coding: utf-8
"""
flyteidl/service/admin.proto
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: version not set
Generated by: https://github.com/swagger-api/swagger-codegen... | StarcoderdataPython |
1631787 | # coding:utf-8
"""
@author:XuMing
"""
from gensim import corpora, models
import config
import jieba
import jieba.analyse
import train
from codecs import open
stopwords_path = config.stopwords_path
segmented_path = config.segmented_path
test_path = config.test_path
raw_path = config.raw_path
result_path = config.resul... | StarcoderdataPython |
3365123 | <filename>src/guid/router.py
"""Router for gathering the views together."""
from fastapi import APIRouter
from guid import views
api_router = APIRouter()
api_router.include_router(views.router, prefix="/guid", tags=["guid"])
| StarcoderdataPython |
1700441 | import json
def test_get_comments(client, valid_jwt):
headers = {'Authorization': 'Bearer %s' % valid_jwt}
response = client.get('/api/tickets/1/comments', headers=headers)
data = json.loads(response.data)
assert response.status_code == 200
assert "comments" in data
assert len(data['comments']... | StarcoderdataPython |
1759159 | <reponame>djangoplicity/blog<filename>djangoplicity/blog/templatetags/blog_utils.py<gh_stars>0
from django import template
from django.utils.html import format_html
from djangoplicity.blog.models import Category
from random import randint
register = template.Library()
@register.inclusion_tag('blog/categories_list.ht... | StarcoderdataPython |
3383631 | <reponame>c-rizz/autoencoding_rl
from typing import Tuple
import torch as th
import torch.nn as nn
from torchvision import transforms
from typing import Dict, Union, List, Tuple
import lr_gym.utils.dbg.ggLog as ggLog
import lr_gym
from autoencoding_rl.latent_extractors.vae.VAE_encoder import VAE_encoder
from autoen... | StarcoderdataPython |
4806483 | <reponame>iamsrp/pixelgames
"""
Classes and functions for handling inputs.
"""
# ======================================================================
from abc import ABC, abstractmethod
from typing import Tuple
# ======================================================================
class SimpleJoystick(ABC):
... | StarcoderdataPython |
1777503 | import sys
import os
import random
import re
sys.path += os.path.abspath(os.path.join(os.path.split(__file__)[0], "../../pylib")),
from simplerpcgen.lang_cpp import emit_rpc_source_cpp
from simplerpcgen.lang_python import emit_rpc_source_python
def error(msg, ctx):
from yapps import runtime
err = runtime.Synta... | StarcoderdataPython |
1625038 | import skimage
import numpy as np
from skimage import io
from skimage.transform import resize
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
def mixSounds(sound_list, weights):
""" Return a sound array mixed in proportion with the ratios given by weights"""
mixSound = np.zeros(len(sound_list[0]))
... | StarcoderdataPython |
3245532 | #!/usr/bin/env python
# coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import sys
import json
from hashlib import sha1
from prompt_toolkit.shortcuts import message_dialog
from kngetx import __author__
from kngetx import __version__
from knget.base import Kng... | StarcoderdataPython |
3321784 | from typing import Dict, Optional, TYPE_CHECKING
from ray.rllib.env import BaseEnv
from ray.rllib.policy import Policy
from ray.rllib.policy.sample_batch import SampleBatch
from ray.rllib.evaluation import MultiAgentEpisode
from ray.rllib.agents.callbacks import DefaultCallbacks
from ray.rllib.utils.typing import Agent... | StarcoderdataPython |
1977 | <reponame>mstoelzle/raisimLib
import os
import numpy as np
import raisimpy as raisim
import math
import time
raisim.World.setLicenseFile(os.path.dirname(os.path.abspath(__file__)) + "/../../rsc/activation.raisim")
world = raisim.World()
ground = world.addGround()
world.setTimeStep(0.001)
world.setMaterialPairProp("st... | StarcoderdataPython |
78950 | <filename>python_lesson_3/python_lesson_3_homework.py
# Функция удаления пунктуации
# Не вводим возврат корретки в сет пунктуации,
# будет убран позже автоматом
def remove_punctuation(corrected_line):
empty = str('')
punct_set = {'.', ',', ':', '?', '!', '—', '«', '»', '(', ')'}
for elem in punct_set:
... | StarcoderdataPython |
3239494 | from .accuracy import Accuracy, accuracy
from .cross_entropy_loss import (CrossEntropyLoss, binary_cross_entropy,
cross_entropy, mask_cross_entropy)
from .focal_loss import FocalLoss, sigmoid_focal_loss
from .ghm_loss import GHMC, GHMR
from .iou_loss import (BoundedIoULoss, CIoULoss, DI... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.