id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
6644052 | <filename>infrastructure/app_stack.py
from aws_cdk import (
core as _core,
aws_apigateway as _apigateway,
aws_lambda as _lambda,
aws_iam as _iam,
)
class AppStack(_core.Stack):
def __init__(self, scope: _core.Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
... | StarcoderdataPython |
12834846 | from ..commandparser import Member
from ..discordbot import unmoot_user
import discord
name = 'unmoot'
channels = None
roles = ('helper', 'trialhelper')
args = '<member>'
async def run(message, member: Member):
'Removes a moot from a member'
await unmoot_user(
member.id,
reason=f'Unmooted by {str(message.autho... | StarcoderdataPython |
1908548 | import random
randNumber = random.randint(1, 100)
# print(randNumber) LET YOU KNOW THE NUMBER ,DELETE IT BEFORE PLAYING THE GAME
userGUESS = None
guesses = 0
while userGUESS != randNumber:
userGUESS = int(input("Enter your guess: "))
guesses += 1
if userGUESS == randNumber:
print("You guessed it ... | StarcoderdataPython |
6590586 | #!/usr/bin/env python
def remove_junk(lst):
new_lst = []
for v, v2 in lst:
if v >= 0 and v < 32:
new_lst.append(v)
return new_lst
f = open('some_result_order_big_t.txt', 'r')
p_text = f.readline()
measure = []
while p_text:
pin_trace = eval(f.readline().strip())
_1_round = eval(f.readline().strip(... | StarcoderdataPython |
8177130 | <gh_stars>10-100
# Copyright (c) 2020 - The Procedural Generation for Gazebo authors
# For information on the respective copyright owner see the NOTICE file
#
# 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 t... | StarcoderdataPython |
1839581 | <filename>python/odd-even.py
n=int(input("enter a number="))
i=1
while i<=n:
if i&1 :
print(i,"is odd")
else:
print(i,"is even")
i=i+1
print("loop ends")
| StarcoderdataPython |
8088555 | import typing
import pandas as pd
import scipy.stats
from pyextremes.models.model_emcee import Emcee
from pyextremes.models.model_mle import MLE
def get_model(
model: str,
extremes: pd.Series,
distribution: typing.Union[str, scipy.stats.rv_continuous],
distribution_kwargs: typing.Optional[dict] = No... | StarcoderdataPython |
1816661 | <reponame>faezakamran/sentence-transformers
from . import SentenceEvaluator
import logging
import os
import csv
from sklearn.metrics.pairwise import paired_cosine_distances, paired_euclidean_distances, paired_manhattan_distances
from sklearn.metrics import average_precision_score
import numpy as np
from typing import L... | StarcoderdataPython |
1838777 | import numpy as np
import pandas as pd
import os.path
import re
def extract_file_name(file_path, extract_file_extension):
"""Takes a file route and returns the name with or without its extesion.
This function is OS independent.
INPUT:
file_path: string.
extract_file_extension: boolean.
... | StarcoderdataPython |
1637159 | # find two numbers that are closest to each other among a list of numbers and print min difference.
# a = [3, 5, 8, 9]
# b = sorted(a)
# minDiff = abs(b[1] - b[0])
# count = 0
# while count < len(b) - 1:
# minDiff = min(minDiff, abs(b[count] - b[count + 1]))
# count += 1
# print(minDiff)
| StarcoderdataPython |
29810 | # data structure module
| StarcoderdataPython |
8137863 | # -*- coding: utf-8 -*-
"""Fun with Car Plate Numbers!
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1kgkowDKhtVaVJl4hacZrjE03nekWu9C_
Good morning! You have completed the math trail on car plate numbers in a somewhat (semi-)automated way.
Can you a... | StarcoderdataPython |
1652067 | <reponame>fbailly/BioptimPaperExamples
from time import time
import biorbd_casadi as biorbd
from bioptim import Solver, OdeSolver
from .gait.load_experimental_data import LoadData
from .gait.ocp import prepare_ocp, get_phase_time_shooting_numbers, get_experimental_data
def generate_table(out):
root_path = "/".j... | StarcoderdataPython |
8057844 | description = 'Helium pressures'
group = 'lowlevel'
devices = dict(
center3_sens1 = device('nicos.devices.generic.ManualMove',
description = 'Center 3 Sensor 1',
default = 3.5e-6,
abslimits = (0, 1000),
fmtstr = '%.1g',
unit = 'mbar',
),
center3_sens2 = device('nico... | StarcoderdataPython |
1941314 | <reponame>Bricktheworld/rhombus-api-examples-python
from json.decoder import JSONDecodeError
import requests
import argparse
import sys
import json
import time
import os
import tkinter
from PIL import Image, ImageTk
class IsDeskOccupied:
#Set up workspace for API calls to Rhombus Systems
def __init__(self,arg... | StarcoderdataPython |
315559 | <reponame>nestorPons/agendaOnLine<filename>.server/usuarios.py
import pymysql
# Conectar con base de datos
conexion = pymysql.connect(host="localhost",
user="root",
passwd="<PASSWORD>",
database="app")
cursor = conexion.cursor()
# Rec... | StarcoderdataPython |
1916921 | <filename>script.py
# from profanity_police.checker import Checker
# from profanity_police.youtube import YoutubeTranscript
# y_transcript = YoutubeTranscript(url = "https://www.youtube.com/watch?v=Vev2ybF2Z6g&ab_channel=AllIndiaBakchod")
# y_transcript.get_original_languages()
# checker = Checker()
# transcript = y_... | StarcoderdataPython |
11371964 | <gh_stars>0
import random
class Tile(object):
def __init__(self, x, y):
self.position = (x, y)
self.occupied = False
self.occupier = ''
self.entity = None
def update(self):
#print "X:%r, Y:%r: " % self.position,
#if self.occupied: print "%s on Tile." % self.occu... | StarcoderdataPython |
9621088 | import os
import xml.etree.ElementTree as ET
import zipfile
class Model:
def __init__(self, ref):
self.ref = ref
self.language_usages = {}
self.roots = []
def add_language_usage(self, usage):
self.language_usages[usage.id] = usage
def add_devkit_usage(self, usage):
... | StarcoderdataPython |
8173174 | <reponame>KevZho/redditbot<filename>kol/request/ApiRequest.py
import kol.Error as Error
from GenericRequest import GenericRequest
from kol.util import Configuration
import json
class ApiRequest(GenericRequest):
def __init__(self, session):
super(ApiRequest, self).__init__(session)
self.url = sessi... | StarcoderdataPython |
6660112 | <reponame>lmicra/paco
# -*- coding: utf-8 -*-
import asyncio
from .partial import partial
from .decorator import overload
from .concurrent import ConcurrentExecutor
from .assertions import assert_corofunction, assert_iter
@overload
@asyncio.coroutine
def some(coro, iterable, limit=0, timeout=None, loop=None):
"""... | StarcoderdataPython |
3527903 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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 l... | StarcoderdataPython |
11222537 | <gh_stars>10-100
"""Client class implementation"""
import asyncio
import reprlib
import logging
from collections import abc
from contextlib import suppress
import json
from typing import Optional, List, Union, Set, AsyncIterator, Type, Any
from types import TracebackType
import aiohttp
from aiocometd.transports impor... | StarcoderdataPython |
9695181 | import time
from typing import Dict, List, Optional, Union
from labml_db import Model, Key, Index
from . import project
from .status import create_status, Status
from .. import settings
class Computer(Model['Computer']):
name: str
comment: str
start_time: float
computer_ip: str
computer_uuid: st... | StarcoderdataPython |
4822338 | <gh_stars>1-10
# SPDX-FileCopyrightText: 2021 Division of Intelligent Medical Systems, DKFZ
# SPDX-FileCopyrightText: 2021 <NAME>
# SPDX-License-Identifier: MIT
import os
import inspect
import glob
import numpy as np
import matplotlib.pylab as plt
from simpa.utils.libraries.literature_values import OpticalTissueProper... | StarcoderdataPython |
266849 | <filename>panda/src/tinydisplay/ztriangle.py
#!/usr/bin/env python
""" This simple Python script can be run to generate
ztriangle_code_*.h, ztriangle_table.*, and ztriangle_*.cxx, which
are a poor man's form of generated code to cover the explosion of
different rendering options while scanning out triangles.
Each diff... | StarcoderdataPython |
4947849 | <gh_stars>0
class JsonValidateError(Exception):
pass
class ErrorMsg:
empty_error = "Json cannot be empty."
syntax_error = "Json element should be string or number."
list_error = "List cannot contains key-value pair."
dict_error = "Dictionary need a key."
map_error = "{} need to close."
err... | StarcoderdataPython |
6416743 | import os
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.model_selection import RepeatedKFold
from sklearn.metrics import classification_report
from ml_model import RandomForest
from ml_model import SVM
from mics ... | StarcoderdataPython |
1828526 | <reponame>lucijabrezocnik/NiaPy<filename>NiaPy/task/task.py
# encoding=utf8
"""The implementation of tasks."""
import logging
from enum import Enum
from matplotlib import pyplot as plt
from numpy import inf, random as rand
from NiaPy.util.utility import (
limit_repair,
fullArray
)
from NiaPy.util.exception ... | StarcoderdataPython |
5125568 | <filename>RB_Utils.py
import ntpath
import sys
import os
import matplotlib
from matplotlib import pyplot as plt
import matplotlib.backends.backend_pdf
import math
import numpy as np
def readVCF(inVCF):
array_Column_Header = ()
array_vcfInfo = []
chr = ""
pos = ""
id = ""
ref = ""
alt = ""
... | StarcoderdataPython |
5086362 | from __future__ import division
import numpy as np
import pandas as pd
from matplotlib.colors import to_rgb
import warnings
from logomaker.src.error_handling import check
from logomaker.src.matrix import ALPHABET_DICT
# Sets default color schemes specified sets of characters
CHARS_TO_COLORS_DICT = {
tuple('ACGT'):... | StarcoderdataPython |
9753687 | """
twinpy
deals with twin boudnary
"""
__version__ = "1.0.0"
| StarcoderdataPython |
363447 | from batou.utils import Address
from batou.component import Component, Attribute
from batou.lib.file import File
from batou.lib.buildout import Buildout
class Test(Component):
address = Attribute(Address, 'default:8080')
def configure(self):
self += File('test', content='asdf {{component.address.lis... | StarcoderdataPython |
1744051 | import requests
import json
from pathlib import Path
class LabelStudioAPI:
def __init__(self, token, debug=True):
self.token = token
self.debug = debug
def Project(self, title='Demo', labelXML="""""", description='New Task', action='create', projID='1'):
if action == 'update':
... | StarcoderdataPython |
6629054 | <reponame>KRNKRS/mgear<gh_stars>10-100
"""
Shifter's Component guide class.
"""
from functools import partial
import maya.cmds as cmds
# pyMel
import pymel.core as pm
from pymel.core import datatypes
# mgear
import mgear
from mgear import string
from mgear.maya import dag, vector, transform, applyop, attribute, cu... | StarcoderdataPython |
1957355 | from .source import SourceOfNews, NewsManager
| StarcoderdataPython |
3202497 | <reponame>nanuxbe/django
from datetime import date, timedelta
from django.contrib import admin
from django.test import TestCase
from .admin import CorporateMemberAdmin
from .models import CorporateMember
class CorporateMemberAdminTests(TestCase):
@classmethod
def setUpTestData(cls):
cls.member = Co... | StarcoderdataPython |
6596065 | """Backend objects for saving and loading data
DataStores provide a uniform interface for saving and loading data in different
formats. They should not be used directly, but rather through Dataset objects.
"""
from .memory import InMemoryDataStore
from .netCDF4_ import NetCDF4DataStore
from .pydap_ import PydapDataSto... | StarcoderdataPython |
6557895 | <filename>intensio/test/python/basic/output/basicRAT-example/core/survey.py
# -*- coding: utf-8 -*-
import ctypes
import getpass
import os
import platform
import socket
import urllib
import uuid
def fRTWRMDwKMKaMMycbCQhFAtbEWeTzpNy(plat_type):
ZLWFyQexObWDAVRgVOJuNGQAedCeFocT = platform.platform()
processor ... | StarcoderdataPython |
8034940 | import time
def timeit(f):
def wrapped(*args, **kwargs):
start = time.perf_counter()
result = f(*args, **kwargs)
print(f"{f.__name__} took: {time.perf_counter() - start}s")
return result
return wrapped | StarcoderdataPython |
1963266 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import numpy as np
import pickle
from sklearn.metrics import confusion_matrix
def softmax(array):
array = np.exp(array)
return array/sum(array)
res_rgb_path = '../work_dirs/mydata/tsn_2d_rgb_resnet101_seg_3_f1s1_b32_g8/test.pkl'
res_flow_path = '../work_dir... | StarcoderdataPython |
1732952 | <filename>waverly_project/urls.py
from django.conf.urls import url
from django.contrib import admin
from waverly import views
urlpatterns = [
url(r'^admin/', admin.site.urls), # admin
url(r'^$', views.index, name="index"), #login
url(r'^(?P<user_name>[\w\-]+)/$', views.account, name="account"), #account pa... | StarcoderdataPython |
90568 | <gh_stars>0
import argparse
import os.path
import time
import serial
import numpy as np
from struct import pack,unpack
alt_conv_factor = 3.2932160
crctable = \
b"\x00\x00\x89\x11\x12\x23\x9b\x32\x24\x46\xad\x57\x36\x65\xbf\x74\
\x48\x8c\xc1\x9d\x5a\xaf\xd3\xbe\x6c\xca\xe5\xdb\x7e\xe9\xf7\xf8\
\x19\x09\x90\x18\x0b... | StarcoderdataPython |
8144267 | <reponame>prafiles/dj-revproxy
# -*- coding: utf-8 -
#
# This file is part of dj-revproxy released under the MIT license.
# See the NOTICE for more information.
# etree object
import posixpath
import urlparse
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.... | StarcoderdataPython |
3519521 | from .route_flow_dn import FlowRouter
from .lake_mapper import DepressionFinderAndRouter
from .flow_direction_DN import grid_flow_directions, flow_directions
__all__ = ['FlowRouter', 'DepressionFinderAndRouter', 'grid_flow_directions',
'flow_directions']
| StarcoderdataPython |
4826372 | <filename>python/ray/serve/tests/test_controller.py
import pytest
import time
import ray
from ray import serve
def test_controller_inflight_requests_clear(serve_instance):
controller = serve.api._global_client._controller
initial_number_reqs = ray.get(controller._num_pending_goals.remote())
@serve.deplo... | StarcoderdataPython |
9690208 | import numpy as np
import cPickle as pickle
import decoder
def main(in_file, char_file, ali_file,num_to_print,lm_file=None):
with open(in_file,'r') as f:
ll_dict = pickle.load(f)
# read char mapping (need it here for alignments)
with open(char_file,'r') as f:
phone_list = map(lambda x: ... | StarcoderdataPython |
3492215 | import string
wordlist = [acehorrst
D = {}
L = []
for i in range(100):
## file[i].split(' ')
for s in string.punctuation:
file[i] =file[i].replace(s, ' ')
## file = file[i].split()
for i in file[i].split() :
#
try:
D[i] += 1
except:
... | StarcoderdataPython |
18760 | class ToolNameAPI:
thing = 'thing'
toolname_tool = 'example'
tln = ToolNameAPI()
the_repo = "reponame"
author = "authorname"
profile = "authorprofile" | StarcoderdataPython |
11283651 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import copy
class EmbedNet(nn.Module):
def __init__(self, base_model, net_vlad):
super(EmbedNet, self).__init__()
self.base_model = base_model
self.net_vlad = net_vlad
def _init_params(self):
... | StarcoderdataPython |
11327144 | # Copyright (c) 2020 Paddle Quantum 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 app... | StarcoderdataPython |
9646646 | # Copyright (c) 2015 <NAME>.
# Uranium is released under the terms of the LGPLv3 or higher.
import inspect
from PyQt5.QtCore import pyqtProperty, pyqtSignal, QObject, QCoreApplication, pyqtSlot
from PyQt5.QtQml import QJSValue
from UM.i18n import i18nCatalog
class i18nCatalogProxy(QObject): # [CodeStyle: Ultimaker... | StarcoderdataPython |
5059213 | <reponame>Intelligent-Systems-Laboratory/cvat
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# import the necessary packages
import imutils
import cv2
import os
import argparse
# import cv2
import torch
import numpy ... | StarcoderdataPython |
49425 | # Copyright (c) 2021, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from src.lyap.verifier.z3verifier import Z3Verifier
from functools import partial
fr... | StarcoderdataPython |
3444699 | """Constants for the laundrify tests."""
from homeassistant.const import CONF_CODE
VALID_AUTH_CODE = "999-001"
VALID_ACCESS_TOKEN = "<PASSWORD>"
VALID_ACCOUNT_ID = "1234"
VALID_USER_INPUT = {
CONF_CODE: VALID_AUTH_CODE,
}
| StarcoderdataPython |
3536450 | # vim:fileencoding=utf-8:noet
from powerline.segments import shell, common
import tests.vim as vim_module
import sys
import os
from tests.lib import Args, urllib_read, replace_attr, new_module, replace_module_module, replace_env, Pl
from tests import TestCase
vim = None
class TestShell(TestCase):
def test_last_st... | StarcoderdataPython |
9611033 | <gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, <NAME> <<EMAIL>>, and others
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of ... | StarcoderdataPython |
3409802 | """The SETools SELinux policy analysis library."""
# Copyright 2014-2015, Tresys Technology, LLC
#
# This file is part of SETools.
#
# SETools is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either vers... | StarcoderdataPython |
11216353 | <reponame>JulyKikuAkita/PythonPrac<filename>cs15211/RobotReturntoOrigin.py<gh_stars>1-10
__source__ = 'https://leetcode.com/problems/robot-return-to-origin/'
# Time: O(N)
# Space: O(1)
#
# Description: Leetcode # 657. Robot Return to Origin
#
# There is a robot starting at position (0, 0), the origin, on a 2D plane.
#... | StarcoderdataPython |
3349121 | <gh_stars>0
from django.contrib.admin.apps import AdminConfig
class MyAdminConfig(AdminConfig):
default_site = 'fxm.admin.MyAdminSite' | StarcoderdataPython |
9720969 | import requests
from subprocess import check_output
class TestMicrok8sBranches(object):
def test_branches(self):
"""Ensures LP builders push to correct snap tracks.
We need to make sure the LP builders pointing to the master github branch are only pushing
to the latest and current k8s sta... | StarcoderdataPython |
1629613 | from django.core.urlresolvers import reverse
from django.test import TestCase
import json
from myshop.models import Product
from myshop.models.manufacturer import Manufacturer
class ProductSelectViewTest(TestCase):
def setUp(self):
manufacturer = Manufacturer.objects.create(name="testmanufacturer")
... | StarcoderdataPython |
6558283 | # recreate_pnx_record.py
""" Given an identifier, get a PNX record, modify it as needed, and output replacement """
import sys
from urllib import error
from get_existing_pnx_record import get_pnx_xml_given_docid # , get_pnx_given_filename
from modify_existing_pnx_record import modify_existing_pnx_record, get_unique_i... | StarcoderdataPython |
88733 | import hashlib
import pickle
import os
import sys
import subprocess
import time
class Colors:
HEADER = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
cache = {}
hashes = []
def get_cache(... | StarcoderdataPython |
9628412 | <gh_stars>1-10
from simplematrixbotlib.api import Api
from simplematrixbotlib.auth import Creds
from simplematrixbotlib.bot import Bot
from simplematrixbotlib.callbacks import Callbacks
from simplematrixbotlib.match import MessageMatch
from simplematrixbotlib.listener import Listener | StarcoderdataPython |
3583199 | <reponame>akatashev/chouette-iot<gh_stars>1-10
import time
import pytest
from chouette_iot.metrics._metrics import MergedMetric, WrappedMetric
def test_merged_metric_successfull_merge():
"""
MergedMetrics of the same type can be merged.
GIVEN: There are 2 MergedMetric objects with the same name, type a... | StarcoderdataPython |
8174032 | import numpy as np
def nelson_siegel_yield(tau, theta):
"""For details, see here.
Parameters
----------
tau : array, shape (n_,)
theta : array, shape (4,)
Returns
-------
y : array, shape (n_,)
"""
y = theta[0] - theta[1] * \
((1 - np.exp(-theta[3] * tau... | StarcoderdataPython |
230964 | #__getitem__ not implemented yet
#a = bytearray(b'abc')
#assert a[0] == b'a'
#assert a[1] == b'b'
assert len(bytearray([1,2,3])) == 3
assert bytearray(b'1a23').isalnum()
assert not bytearray(b'1%a23').isalnum()
assert bytearray(b'abc').isalpha()
assert not bytearray(b'abc1').isalpha()
# travis doesn't like this
#as... | StarcoderdataPython |
9717522 | <gh_stars>1-10
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import scipy
import pylab
import scipy.linalg as sl
import random
from collections import defaultdict
import h5py
def normalize(x):
n = scipy.sqrt(scipy.inner(x,x))
#n = sl.norm(x, scipy.inf)
if n > 0:
return x/n
else:
return x
... | StarcoderdataPython |
1999403 | # Aula 19 Dicionarios. É assim que tratamos os dicionarios
brasil = [] # Criando uma lista [0] [1] [2] ex:
estado1 = {'uf': 'Rio de Janeiro', 'sigla': 'RJ'} # Criando dicionarios
estado2 = {'uf': 'São Paulo', 'sigla': 'SP'} # Criando dicionarios
brasil.append(estad... | StarcoderdataPython |
1683236 | from .database import MongoDBConnect
from .reader import MongoDBReader
from .actions import MongoDBActions
| StarcoderdataPython |
4920793 | <filename>inputs/new_frag_job.py
import dill
import numpy as np
import os
import sys
fragment_name = sys.argv[1]
level = sys.argv[2]
batch = sys.argv[3]
folder = sys.argv[4]
infile = open(fragment_name, 'rb')
frag_class = dill.load(infile)
#make changes as needed to frag_class
# example:
# frag_class.qc_backend.spi... | StarcoderdataPython |
3458903 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Simple Bot to reply to Telegram messages
# This program is dedicated to the public domain under the CC0 license.
"""
This Bot uses the Updater class to handle the bot.
First, a few callback functions are defined. Then, those functions are passed to
the Dispatcher and r... | StarcoderdataPython |
3556244 | from straph.generators import erdos_renyi, barabasi_albert
from straph.parser import parser, sort_csv
from straph.paths import Path
from straph.paths import Metawalk
from straph.stream import (StreamGraph,
read_stream_graph,
stream_graph_from_events_list,
... | StarcoderdataPython |
1614298 | <filename>HOP_Learning_Algorithm/classification_mnist.py
#classification_mnist.py
#
#Semi-supervised classification example:
#This script shows how to construct a weight matrix for the whole
#MNIST dataset, using precomputed kNN data, randomly select some
#training data, run Laplace and Poisson Learning, and compute a... | StarcoderdataPython |
4980384 | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | StarcoderdataPython |
3482958 | <filename>libs/labelFile.py<gh_stars>100-1000
import os.path
import sys
from .pascal_voc_io import PascalVocWriter
from base64 import b64encode, b64decode
class LabelFileError(Exception):
pass
class LabelFile(object):
# It might be changed as window creates
suffix = '.lif'
def __init__(self, filena... | StarcoderdataPython |
257079 | import numpy as np
import pandas as pd
from scipy.io import arff
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from tqdm import tqdm
import csv
class DimensionValueError(ValueError):
pass
class TypeError(ValueError):
pass
class IterError(ValueError):
pass
class Da... | StarcoderdataPython |
166194 | from copy import deepcopy
from typing import Any, Dict
def merge_dicts(a: Dict, b: Dict):
"""Merge two dictionaries in a recursive way.
It means that if there is a key match, the keys is merged as well.
Only dict and list keys merging is supported
Args:
a (Dict):
b (Dict)
Raises:
... | StarcoderdataPython |
1950485 | import mysql.connector
from backupdb import *
def flushDB():
backupDataBase()
db_connection = mysql.connector.connect(host="localhost", user="django", passwd="<PASSWORD>", database="detectionnav")
db_cursor = db_connection.cursor()
db_cursor.execute('DELETE FROM DetectionChart_techniques')
db_curs... | StarcoderdataPython |
316275 | <reponame>PauMAVA/feather<filename>feather/generated/generators/biome.py
# Generation of the Biome enum. Uses minecraft-data/biomes.json.
import common
data = common.load_minecraft_json("biomes.json")
variants = []
ids = {}
names = {}
display_names = {}
rainfalls = {}
temperatures = {}
for biome in data:
variant... | StarcoderdataPython |
6607385 | """
Utility functions for the benchmarks
==========================================
"""
import importlib
import os
import time
import matplotlib as mpl
from matplotlib import pyplot as plt
from si_prefix import si_format
import numpy as np
import torch
import jax
use_cuda = torch.cuda.is_available()
#############... | StarcoderdataPython |
1838523 | <reponame>ClaudeCoulombe/AgentConversationnel
from setuptools import setup
setup(name='AgentConversationnel',
version='0.1',
description='Agent conversationnel en français',
url='https://github.com/ClaudeCoulombe/AgentConversationnel',
authors=['<NAME>'],
authors_email=['<EMAIL>'],
... | StarcoderdataPython |
80123 | <gh_stars>0
from nose.tools import assert_true, assert_raises
import config
import os
os.environ["TEST_TOKEN"] = "1234"
os.environ["TEST_NAME"] = "test_room"
def test_Env_GivenVariableArray_LoadsVariablesFromOs():
env_vars = ['TEST_TOKEN', 'TEST_NAME']
conf = config.Env(env_vars)
assert_true(conf.env['TE... | StarcoderdataPython |
205363 | from django.conf.urls import include
from django.urls import path
from blog import views as blog_views
from storage import views as strage_views
from work import views as work_views
from account import views as account_views
from rest_framework import routers
blog_router = routers.DefaultRouter()
blog_router.register(... | StarcoderdataPython |
5103842 | <reponame>os-climate/sostrades-core<gh_stars>1-10
'''
Copyright 2022 Airbus SAS
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 ap... | StarcoderdataPython |
5035904 | from django.conf import settings
from django import http
from django import urls
ACCESS_CONTROL_MAX_AGE = getattr(settings, 'ACCESS_CONTROL_MAX_AGE', 0)
ACCESS_CONTROL_ALLOW_ORIGINS = set(getattr(settings, 'ACCESS_CONTROL_ALLOW_ORIGINS', []))
ACCESS_CONTROL_ALLOW_HEADERS = set(map(str.lower, getattr(
settings, '... | StarcoderdataPython |
11322379 | """
Generates a schema diagram of the database based on the
SQLAlchemy schema.
"""
from eralchemy import render_er
from ferry.database.models import Base
render_er(Base, "../docs/db_diagram.png")
| StarcoderdataPython |
1994419 | <filename>tests/test_webclient.py<gh_stars>1-10
"""
from twisted.internet import defer
Tests borrowed from the twisted.web.client tests.
"""
import os
import shutil
import OpenSSL.SSL
from twisted.trial import unittest
from twisted.web import server, static, util, resource
from twisted.internet import reactor, defer
t... | StarcoderdataPython |
5141856 | # -*- coding: utf-8 -*-
import logging
import paho.mqtt.client as mqtt
import json
from matrix.matrixled import MatrixLed, get_led, LedRunner, colors
class LedControl:
_SUB_ON_HOTWORD = 'hermes/hotword/default/detected'
_SUB_ON_SAY = 'hermes/tts/say'
_SUB_ON_THINK = 'hermes/asr/textCaptured'
_SUB_ON_... | StarcoderdataPython |
4950869 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware Inc.
#
# 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 ... | StarcoderdataPython |
1999635 | #!/usr/bin/env python
import argparse
import glob
import re
from re import search
import pandas as pd
import matplotlib.pyplot as plt
#import seaborn as sns
if __name__ == '__main__':
parser = argparse.ArgumentParser()
#directory with the slurm logs
parser.add_argument('--dir', required=True)
args = parse... | StarcoderdataPython |
3531373 | <gh_stars>1-10
#!/usr/bin/env python
import csv
import itertools
import cv2
import numpy as np
from tqdm import tqdm
def read_rgb_image(img_path, size, flip):
assert type(size) is tuple, "size parameter must be a tuple, (96, 96) for instance"
img = cv2.imread(img_path, cv2.IMREAD_COLOR)
if img is None:
... | StarcoderdataPython |
8170847 | <filename>sensorai/layers.py
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/02_layers.ipynb (unless otherwise specified).
__all__ = ['AdaptiveConcatPool1d', 'AdaptiveConcatPool2d', 'PoolType', 'adaptive_pool']
# Cell
from .imports import *
from .tf_imports import *
# Cell
class AdaptiveConcatPool1d(keras.layers.Lay... | StarcoderdataPython |
6489970 | START = "Yes, I'm Kazuma."
RESTART = "Re;Starting Bot in Another Instance from Zero."
GITPULL = "Re;Starting Bot in Another Instance from the Latest Commit."
NOT_SUDO = "This is a developer restricted command.\nYou do not have permissions to run this."
STEALING = "_STEAL!!_"
STEALING_PACK = "Stolen {} out of {} sticke... | StarcoderdataPython |
8140760 | # experiment tracker
import sys
import os
import numpy as np
import pandas as pd
from dask import compute, delayed
sys.path.append('../../')
sys.path.append('../')
sys.path.append('../../experiment-impact-tracker/')
from experiment_impact_tracker.data_interface import DataInterface
from experiment_impact_tracker.data... | StarcoderdataPython |
11293222 | <gh_stars>1-10
from typing import Callable, Any, List
from pandas import Series, concat
from probability.calculations.mixins import OperatorMixin
from probability.custom_types.calculation_types import CalculationValue
from probability.utils import is_scalar
class ArrayOperator(OperatorMixin, object):
"""
An... | StarcoderdataPython |
315667 | <reponame>Dlubal-Software/RFEM_Python_Client<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
PROJECT_ROOT = os.path.abspath(os.path.join(
os.path.dirname(__file__),
os.pardir)
)
sys.path.append(PROJECT_ROOT)
from RFEM.initModel import Model
from RF... | StarcoderdataPython |
1748130 | class Frood:
def __init__(self, age):
self.age = age
print("Frood initialized")
def anniversary(self):
self.age += 1
print("Frood is now {} years old".format(self.age))
f1 = Frood(12)
f2 = Frood(97)
f1.anniversary()
f2.anniversary()
f1.anniversary()
f2.anniversary()
| StarcoderdataPython |
6633963 | <reponame>Its-LALOL/Python-Helper
# https://github.com/Its-LALOL/Python-Helper
from random import choice
from time import sleep
from os import name as osname, system
try: from urllib.request import urlopen
except: from urllib2 import urlopen
def random_chars(amount, english_chars=True, russian_chars=False, nu... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.