id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
8152111 | <gh_stars>1-10
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# %% [markdown]
# # Process the raw mooring data
#
# Contents:
# * <a href=#raw>Raw data reprocessing.</a>
# * <a href=#corrected>Interpolated data processing.</a>
# * <a href=#ADCP>ADCP processing.</a>
# * <a href=#VMP>VMP processing.</a>
#
# Import the nee... | StarcoderdataPython |
11274669 | # This code contains at least 9 defects .
# Try to fix them all based on the error messages。
import pygame
from pygame import image, Rect, Surface
TILE_POSITIONS = [
('#', 0, 0), # wall
(' ', 0, 1), # floor
('.', 2, 0), # dot
('*', 3, 0), # player
]
SIZE = 32
# image = 'tiles.xpm'
def get_tile_re... | StarcoderdataPython |
1649608 | """
"""
import wtl.options as wopt
import gzip
import json
import itertools
import re
program = 'likeligrid'
def iter_args(infiles, range_s, concurrency, rest, epistasis, tp53):
const = [program, '-j{}'.format(concurrency)] + rest
axes = wopt.OrderedDict()
axes['s'] = range_s
for v in wopt.sequentia... | StarcoderdataPython |
4935917 | # -*- coding: utf-8 -*-
"""
flybirds common error
"""
import flybirds.core.global_resource as gr
class FlybirdNotFoundException(Exception):
"""
not find flybirds
"""
def __init__(self, message, select_dic, error=None):
message = f"selectors={str(select_dic)} {message}"
if error is not... | StarcoderdataPython |
8172126 | # -*- coding: utf-8 -*-
# @Time : 2020/1/7 晚上10:00
# @Author : upcbdipt
# @Project : CDW_FedAvg
# @FileName: tf_utils
import tensorflow as tf
def __num_elems(shape):
"""Returns the number of elements in the given shape
Args:
shape: TensorShape
Return:
tot_elems: int
"""
tot_el... | StarcoderdataPython |
1691787 | # -*- coding: utf-8 -*-
"""
Created 2018/12 by Shintaro
Modified 2021/02 by Hermann for usage at Wodan; look for "HE:"
"""
from qcodes import Instrument, validators as vals
from qcodes.instrument.channel import InstrumentChannel, ChannelList
from qcodes.utils.validators import Validator
from qcodes.instrument.paramet... | StarcoderdataPython |
9721086 | '''
Created on Nov 29, 2011
@author: jpoyau
'''
from service_template import ServiceTemplate
from setup_utils import getInput, PublishDoc, isBoolean, YES, isInt
import pystache, uuid
import json
def install(server, dbname, setupInfo):
custom_opts = {}
active = getInput("Enable Network Node Status?", "T", is... | StarcoderdataPython |
336633 | <reponame>lezh/ai-platform-samples<filename>notebooks/samples/tensorflow/sentiment_analysis/dataflow/PubSubToBigQueryWithAIPlatform.py
# Copyright 2020 Google LLC.
#
# 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 co... | StarcoderdataPython |
6567320 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 29 17:07:52 2017
@author: Rigved
"""
#data analysis and wrangling
import pandas as pd
#import numpy as np
#import random as rnd
# visualization
import matplotlib.pyplot as plt
#import plotly.offline as py
#import plotly.graph_objs as go
import seaborn as sns
train_df... | StarcoderdataPython |
6627050 | import sys
import re
if len(sys.argv) < 3 :
print "Usage: pyton extractOptimizedCoords.py input.log xyz|gjf"
print "The output file name will be input[_optimized]_out.xyz|gjf"
print "If optimization failed, the coordinates for the lowest energy structure will be used."
exit()
finput = sys.argv[1]
fformat = sys.ar... | StarcoderdataPython |
363177 | <gh_stars>0
#-*-coding:utf-8-*-
import redis
conn = redis.Redis() | StarcoderdataPython |
3281960 | <gh_stars>0
from unittest.mock import patch
import pandas as pd
import pytest
from powersimdata.tests.mock_scenario import MockScenario
from postreise.plot.plot_bar_generation_stack import plot_bar_generation_stack
mock_plant = {
"plant_id": ["A", "B", "C", "D", "E", "F", "G", "H"],
"zone_id": [301, 302, 303... | StarcoderdataPython |
1893215 | def fib(num):
a, b = 1, 1
while a < num:
print(a, end=" ")
a, b = b, a + b
fib(100)
# a =1
| StarcoderdataPython |
6695081 | #
# ===============LICENSE_START=======================================================
# Acumos
# ===================================================================================
# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
# =================================================================... | StarcoderdataPython |
12861781 | from django.shortcuts import render
# Create your views here.
def home(request):
return render(request,'core/index.html')
def detail(request):
pass
| StarcoderdataPython |
275043 | <filename>hexa/pipelines/management/commands/environment_sync.py
from logging import getLogger
from django.core.management.base import BaseCommand
from django.db import transaction
from hexa.pipelines.models import Environment
from hexa.plugins.app import ConnectorAppConfig
logger = getLogger(__name__)
class Comma... | StarcoderdataPython |
137541 | '''
Psychophysics.py: Script containing functions to measure relevant psychophysical metrics for various tasks.
'''
import matplotlib.pyplot as plt
import numpy as np
import numpy.random as npr
import time
def dRSG_metronomic(RNN, ntrials=1, threshold=0.1, showtrialplots=1, **kwargs):
'''
Function designed fo... | StarcoderdataPython |
11247688 | # note
import os
import json
the_notes = []
#get the list of notes
def get_notes():
global the_notes
if os.path.exists("notes.json"):
with open("notes.json","r") as f:
the_notes = json.load(f)
return the_notes
# add a note to the list of notes
def add_note(note):
global the_notes... | StarcoderdataPython |
375430 |
for v in graph.getVertices():
print(v.value.rank) | StarcoderdataPython |
11299924 | <filename>maha/constants/general.py<gh_stars>1-10
from typing import List
from .arabic import ARABIC_NUMBERS, ARABIC_PUNCTUATIONS
from .english import ENGLISH_NUMBERS, ENGLISH_PUNCTUATIONS
SPACE: str = " "
""" Space character """
EMPTY: str = ""
""" Empty character """
PUNCTUATIONS: List[str] = ARABIC_PUNCTUATIONS + ... | StarcoderdataPython |
3556028 | #
# Copyright (c) 2019-2020 Google LLC. All Rights Reserved.
# Copyright (c) 2016-2018 Nest Labs Inc. 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
#
# ... | StarcoderdataPython |
8016736 | def is_ajax(request):
"""Check if the request is ajax or not"""
return any(
[
request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest',
request.META.get('HTTP_ACCEPT') == 'application/json'
]
)
| StarcoderdataPython |
6676339 | list1 = [34, 46, 58, 56, 22, 62, 34, 97, 57]
print(list1[0:3])
print(list1[3:6])
print(list1[6:9])
print(list1[-2:])
print(list1[7:])
print(list1[:-2])
for index in list1:
print(index)
print('----')
# for문 내에서 index 값을 변경하여도 원래 지정한 range 범위 순서를 벗어나지 않음을 보장함
for index in range(0, len(list1)):
print(f'index = {ind... | StarcoderdataPython |
9680664 | """
Django settings for reminders project.
Generated by 'django-admin startproject' using Django 2.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
... | StarcoderdataPython |
4989634 | <filename>data_augmentation/setup.py
from setuptools import find_packages, setup
setup(
name="EDA",
version="0.0.1",
description="Understanding the data augmentation using Emmnetal.",
install_requires=[
"emmental>=0.0.5,<0.1.0",
"pillow>=8.3.2,<9.0.0",
"torchvision>=0.4.2,<0.5.0... | StarcoderdataPython |
4826954 | # Copyright 2020 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
from .toolchain_profiler import ToolchainProfiler
import json
import... | StarcoderdataPython |
93408 | # -*- coding: utf-8 -*-
from .java_data import NontermClass, StateClass, Method, StartingMethod
from .java_data import BOTTOM, CONTEXT, METHOD
def encode(table):
files = dict((BOTTOM, CONTEXT, METHOD))
ntcs = {}
for sym in table.groups:
ntcs[sym] = NontermClass(sym.text, sym == table.start, table... | StarcoderdataPython |
203854 | #! /usr/bin/python
# -*- coding: utf-8 -*-
"""My general server framework."""
import socketserver
import threading
from message import Message
import network_utils as nu
class GameMessageHandler(socketserver.StreamRequestHandler):
def handle(self) -> None:
server = self.server # type: GameServer
... | StarcoderdataPython |
1650344 | from .draw import draw_rectangle
from .grid import create_meshgrid, create_meshgrid3d
from .helpers import _extract_device_dtype
from .image import image_to_tensor, ImageToTensor, tensor_to_image
from .memory import batched_forward
from .one_hot import one_hot
from .pointcloud_io import load_pointcloud_ply, save_pointc... | StarcoderdataPython |
3370044 | from django.urls import path
# from .views import SportsmanView
app_name = "network"
urlpatterns = [
# path("", NetworkView.as_view(), name="index"),
# path("", SportsmanView.as_view()),
]
| StarcoderdataPython |
91280 | <reponame>LI-Mingyu/GraphScope-MY<gh_stars>1000+
import networkx.algorithms.traversal.tests.test_bfs
import pytest
from graphscope.nx.utils.compat import import_as_graphscope_nx
import_as_graphscope_nx(networkx.algorithms.traversal.tests.test_bfs,
decorators=pytest.mark.usefixtures("graphscope... | StarcoderdataPython |
288975 | import numpy as np
import pandas as pd
import os
from datetime import datetime
from ..options.OptionPortfolio import OptionPortfolio
from matplotlib.backends.backend_pdf import PdfPages
from ..basicData.basicData import BasicData
from ..strategy import *
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] =... | StarcoderdataPython |
6698850 | <gh_stars>0
# import theano
# import theano.tensor as T
from scipy.optimize import fmin_l_bfgs_b
import deepvis.proximal_alg
import numpy as np
import tensorflow as tf
class TensorFlowTheanoFunction(object):
def __init__(self, inputs, outputs):
self._inputs = inputs
self._outputs = outputs
def __call__(se... | StarcoderdataPython |
393062 | import pytest
from guardian.shortcuts import assign_perm
from tests.factories import UserFactory
from tests.hanging_protocols_tests.factories import HangingProtocolFactory
from tests.utils import get_view_for_user
@pytest.mark.django_db
def test_permission_required_views(client):
user = UserFactory()
... | StarcoderdataPython |
67638 | <reponame>e-dang/cookiecutter-django
from rest_framework import serializers
class DetailResponseSerializer(serializers.Serializer):
detail = serializers.CharField(read_only=True)
class NonFieldErrorResponseSerializer(serializers.Serializer):
non_field_errors = serializers.CharField(read_only=True)
| StarcoderdataPython |
363648 | # !/usr/bin/python
class Monday:
def __init__(self,name):
name = name
xx = '1'
@staticmethod
def print_word(w):
print(w)
@classmethod
def class_method(cls,x):
print(x)
def fn(self, y):
print(y)
Monday().print_word('hhh')
Monday.print_word('hhhxxx')
Monday.... | StarcoderdataPython |
5156030 | from django.conf import settings
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from wagtail.core import views
from wagtail.core.utils import WAGTAIL_APPEND_SLASH
if WAGTAIL_APPEND_SLASH:
# If WAGTAIL_APPEND_SLASH is True (the default value), we match a
# (possibly empty)... | StarcoderdataPython |
6652071 | import sys
import math
import posix
from orbit.lattice import AccLattice, AccNode, AccActionsContainer
lattice = AccLattice("test_lattice")
elem1 = AccNode("el-1")
elem2 = AccNode("el-2")
elem3 = AccNode("el-3")
elem1.setLength(1.1)
elem2.setLength(2.1)
elem3.setLength(3.1)
lattice.addNode(elem1)
lattice.addNode(e... | StarcoderdataPython |
3591686 | #!/usr/bin/python
import sys, argparse
from subprocess import PIPE, Popen
from multiprocessing import cpu_count, Pool, Lock
glock = Lock()
of = None
def main():
parser = argparse.ArgumentParser(description="",formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('input',nargs='+',help="Files ... | StarcoderdataPython |
1863767 | <gh_stars>1-10
from twitter import *
import requests
import os
import config
config.ensure()
TT_CONSUMER = config.get("TWITTER_CAPYBARA_CONSUMER_KEY")
TT_SECRET = config.get("TWITTER_CAPYBARA_SECRET")
MY_TWITTER_CREDS = os.path.expanduser('.capybara-credentials')
if not os.path.exists(MY_TWITTER_CREDS):
oauth_d... | StarcoderdataPython |
1676719 | # -*- coding: utf-8 -*-
from ThymeBoost.trend_models.trend_base_class import TrendBaseModel
import numpy as np
from statsmodels.tsa.api import SimpleExpSmoothing, Holt
class EtsModel(TrendBaseModel):
"""Several ETS methods from Statsmodels including:
'ses': Simple Exponential Smoother
'des'... | StarcoderdataPython |
11321016 | <reponame>iLordTony/django-angular-example<gh_stars>0
from django.conf.urls import url, include
from api.views import UserList, PostDetail, PostList, UserPostList, UserDetail, PostPhotoList, PhotoList, PhotoDetail
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsa... | StarcoderdataPython |
4855042 | <reponame>fareszr/app
from flask import url_for
from app.db import Session
from app.models import User, ApiKey
from tests.utils import login
def test_create_delete_api_key(flask_client):
user = login(flask_client)
Session.commit()
# create api_key
create_r = flask_client.post(
url_for("dashb... | StarcoderdataPython |
3563985 | class prime():
def __init__(self, n):
self.n = n
def get_factor(self):
for i in range(2, self.n+1):
if self.n % i == 0:
yield i
#return self.fac
def prime_or_not(self, n):
for i in range(2, int(n/2)+1):
if n % i == 0:... | StarcoderdataPython |
3559827 | #!/usr/bin/env python
#
# Original Version: bjian 2008/10/27
# 3-D extension: PJackson 2013/06/06
# More datatypes, Multiple Channels, Python 3, ...: <NAME>
#
from __future__ import division, print_function
import os
import numpy as np
import array
import zlib
def read_meta_header(filename):
"""Return a di... | StarcoderdataPython |
3360383 | from typing import Sequence
from uuid import UUID
from hexbytes import HexBytes
from web3 import Web3
def calculate_device_registration_hash(
timestamp: int,
identifier: UUID,
cloud_messaging_token: str,
safes: Sequence[str],
prefix: str = "gnosis-safe",
) -> HexBytes:
safes_to_str = "".join(... | StarcoderdataPython |
1981333 | <filename>kolibri/core/auth/constants/role_kinds.py
"""
This module contains constants representing the kinds of "roles" that a user can have with respect to a Collection.
"""
from __future__ import unicode_literals
ADMIN = "admin"
COACH = "coach"
ASSIGNABLE_COACH = "classroom assignable coach"
choices = (
(ADMIN... | StarcoderdataPython |
378795 | import pathlib
import tempfile
from unittest import mock
from docker.errors import ImageNotFound
from docker.errors import NotFound
from teststack import cli
def test_render(runner, tag):
with tempfile.NamedTemporaryFile() as tmpfile:
result = runner.invoke(cli, ['render', f'--dockerfile={tmpfile.name}'... | StarcoderdataPython |
126452 | <reponame>jessicachung/rna_seq_pipeline
#---------------------------------
# BATCH DEFAULTS
#---------------------------------
# The default options applied to each stage in the shell script. These options
# are overwritten by the options provided by the individual stages in the next
# section.
# Stage options which Ru... | StarcoderdataPython |
1734770 | <filename>__init__.py
import logging
import asyncio
import collections
import homeassistant.helpers.config_validation as cv
import voluptuous as vol
from homeassistant.helpers import aiohttp_client
_LOGGER = logging.getLogger(__name__)
DOMAIN = 'grohe_sense'
CONF_REFRESH_TOKEN = '<PASSWORD>'
CONFIG_SCHEMA = vol.S... | StarcoderdataPython |
249291 | import numpy as np
class Poetry:
def __init__(self):
self.poetry_file = 'poetry.txt'
self.poetry_list = self._get_poetry()
self.poetry_vectors, self.word_to_int, self.int_to_word = self._gen_poetry_vectors()
self.batch_size = 64
self.chunk_size = len(self.poetry_vectors) /... | StarcoderdataPython |
3207213 | from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0040_page_draft_title'),
('cms', '0010_transcriptions'),
]
operations = [
migrations.AddField(
model_name='image',
... | StarcoderdataPython |
4979436 | <filename>Bio/EUtils/ReseekFile.py
"""Wrap a file handle to allow seeks back to the beginning
Sometimes data coming from a socket or other input file handle isn't
what it was supposed to be. For example, suppose you are reading from
a buggy server which is supposed to return an XML stream but can also
return an unfor... | StarcoderdataPython |
9659631 | <gh_stars>0
"""
*******************************************************************************
* BTChip Bitcoin Hardware Wallet Python API
* (c) 2014 BTChip - 1BTChip7VfTnrPra5jqci7ejnMguuHogTn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in ... | StarcoderdataPython |
6500823 | """
Escreva um programa que leia um número N inteiro qualquer e mostre na tela os N primeiros elementos de uma Sequência
de Fibonacci.
"""
print('-' * 30)
print('Sequência de Fibonnacci')
print('-' * 30)
n = int(input('Quantos termos você quer mostrar? '))
t1 = 0
t2 = 1
print('~' * 30)
print(f'{t1} → {t2}'... | StarcoderdataPython |
1849284 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
"""
the input x in both networks should be [o, g], where o is the observation and g is the goal.
"""
# define the actor network
class actor(nn.Module):
def __init__(self, env_params):
super(actor, self).__init__()
... | StarcoderdataPython |
6678495 | import os
import os.path
from Compiler_teaching_platform.settings import BASE_DIR
def dfs_showdir(path, depth):
if depth == 0:
print("root:[" + path + "]")
for item in os.listdir(path):
# if '.git' not in item and '.css' not in item:
if '.py' in item or '.' not in item:
if '... | StarcoderdataPython |
9616800 | <filename>evaluate.py
"""
Copyright (c) College of Mechatronics and Control Engineering, Shenzhen University.
All rights reserved.
Description :
evaluation, run this script, then cd into './evaluation' and run eval_tools.py
Author:<NAME>
"""
import tensorflow as tf
import numpy as np
import cv2
import os
from time im... | StarcoderdataPython |
8031342 | from fifo_animal_shelter import __version__
from fifo_animal_shelter.fifo_animal_shelter import Queue, Node, AnimalShelter
def test_version():
assert __version__ == '0.1.0'
def test_enqueue():
actual = []
animal = AnimalShelter()
animal.enqueue('bobi', 'dog')
actual += [animal.dog.peek()]
an... | StarcoderdataPython |
95695 |
import torch
from sklearn.linear_model import Ridge
import signatory
class InvestConsumption():
def __init__(self, params):
self.T = params["T"]
self.N = params["N"]
self.device = params["device"]
def initialize(self, typeVec):
"""
input:
... | StarcoderdataPython |
9798683 | <filename>codewars/7kyu/doha22/max_lenght/max_lenght.py
def mxdiflg(a1, a2):
if a1 and a2:
res1 = max([len(x) for x in a1])
res11 = min([len(x) for x in a1])
res2 = max([len(x) for x in a2])
res22 = min([len(x) for x in a2])
return max(res1 - res22, res2 - res11)
else:
... | StarcoderdataPython |
68709 | <reponame>troncosoae/jetson-exp
import matplotlib.pyplot as plt
import numpy as np
import os
import PIL
import tensorflow as tf
from tensorflow import keras
import pathlib
import time
import sys
from Net.Net import Net
if __name__ == "__main__":
DEVICE = 'gpu'
try:
DEVICE = sys.argv[1]
except In... | StarcoderdataPython |
9755093 | <filename>safe_intervals.py
import sys
from itertools import groupby, dropwhile, tee
import random
import argparse
def main(args):
# @SQ SN:GL000222.1 LN:18686...
chr_header = [l.strip().split() for l in args.dict if l.startswith('@SQ')]
assert all(
l[1].startswith('SN') and l[2].startswith(... | StarcoderdataPython |
4941350 | #!/usr/bin/env python
import roslib; roslib.load_manifest("neato_node");
import rospy
from what_is_my_name import what_is_my_name
from std_msgs.msg import Int8, String
from geometry_msgs.msg import Twist
from std_msgs.msg import Int32
from neato_driver.neato_driver import Botvac
class PacketReplicatorNode:
'''
... | StarcoderdataPython |
1619480 | <reponame>human-science/adpy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Insert preamble to the specific asciidoc files in adoc folder.
# Toll's default preamble can be overridden by preamble written in a specific asciidoc file from adoc folder.
import re
import sys
import os
def main():
args = sys.argv
l... | StarcoderdataPython |
3448301 | <gh_stars>1-10
import unittest
from main import *
from unittest.mock import MagicMock, Mock
class TestSolver(unittest.TestCase):
def test_zero_order_root(self):
params = [[0], [4]]
expected = ["all", "undefined"]
for i in range(0, len(expected)):
solver = Solver(params[i])
... | StarcoderdataPython |
9621073 | <filename>tools/gt_map_visualization/gps_from_bag.py<gh_stars>10-100
#!/usr/bin/env python
#
# example usage:
#
import rosbag, rospy
import glob
import argparse
import numpy as np
import tf
import tf.transformations
import utm
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='extract traj... | StarcoderdataPython |
3227397 | <filename>project.py<gh_stars>0
import collections
import os
import re
import shutil
import subprocess
import sys
import urllib.request
import zipfile
import string
import logging
import logging.handlers
import struct
import yaml
# from configparser import ConfigParser
from pathlib import Path
import exceptions
if g... | StarcoderdataPython |
360726 | import os
import torch
import torch.nn as nn
from torch.cuda import empty_cache
from torch.nn.utils import clip_grad_norm_
from tqdm import trange
from atari_utils.logger import WandBLogger
from simple.adafactor import Adafactor
class Trainer:
def __init__(self, model, config):
self.model = model
... | StarcoderdataPython |
3209629 | <filename>stocks/stocks.py
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
import robin_stocks_modified as robin_stocks
from Utils.datetime_funcs import *
from Utils import login
"""Wrappers for bare robin_stocks functions"""
def get_stock_historicals(symbol, interval="5... | StarcoderdataPython |
110100 | <reponame>tirgei/stack-overflow-lite-api
import os
from flask import Flask
from instance.config import app_config
from app.api.v1.views.user_views import v1 as users_v1
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(app_config[config_name])
app.register_blueprint(users_v1)
... | StarcoderdataPython |
6616813 | from unittest import TestCase
class TestPlotVariantTypeData(TestCase):
def test_plot_variant_type_data(self):
self.fail()
| StarcoderdataPython |
1706537 | ##################################
# Laboratory Server configuration #
##################################
laboratory_assigned_experiments = {
'exp1:dummy@Dummy experiments' : {
'coord_address' : 'experiment1:laboratory1@core_machine',
'checkers' : ()
},
}
| StarcoderdataPython |
4841638 | # -*- coding: utf-8 -*-
"""
Extracts number of replies from a tweet.
Created on Fri Oct 22 00:58:01 2021
@author: Yannik
"""
from code.feature_extraction.feature_extractor import FeatureExtractor
import numpy as np
class RepliesExtractor(FeatureExtractor):
"""Collects the number of replies for a Tweet and store... | StarcoderdataPython |
1602116 | <gh_stars>0
#https://colab.research.google.com/drive/1AOkk-TSDFbvCb3Mxb7sTqRMAFbMi6Ra-?usp=sharing#scrollTo=vgZemXj6hejq
#!apt install tesseract-ocr-rus
#!apt install libtesseract-dev
#!pip install pytesseract
import pytesseract
import cv2
import pandas as pd
#Для таблиц
#!!pip install table_ocr
import num... | StarcoderdataPython |
12842204 | <gh_stars>10-100
import gym
import numpy as np
from viewer import OpenCVImageViewer
class GymWrapper(object):
"""
Gym interface wrapper for dm_control env wrapped by pixels.Wrapper
"""
metadata = {'render.modes': ['human', 'rgb_array']}
reward_range = (-np.inf, np.inf)
def __init__(self, env)... | StarcoderdataPython |
12231 | import importlib
import os
import pytest
from helpers import running_on_ci
import janitor.biology # noqa: F403, F401
# Skip all tests if Biopython not installed
pytestmark = pytest.mark.skipif(
(importlib.util.find_spec("Bio") is None) & ~running_on_ci(),
reason="Biology tests relying on Biopython only requ... | StarcoderdataPython |
1806945 | <gh_stars>10-100
'''
python setup.py sdist bdist_wheel
python -m twine upload dist/*
'''
import sys
import os
import glob
import setuptools
from setuptools import setup, find_packages
from torch.utils.cpp_extension import CUDA_HOME, CppExtension, CUDAExtension, BuildExtension
requirements = ["torch"]
def get_extensi... | StarcoderdataPython |
364345 | <filename>ds18b20S/__init__.py
#Code by <NAME>
#Library for ds18b20 temperature sensor
#Contact`
#Email: <EMAIL>
import sys
import glob
import os
class DsbS():
def __init__(self, initial=False):
if initial:
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')... | StarcoderdataPython |
3485549 | # ===========================================================================
# distmap.py --------------------------------------------------------------
# ===========================================================================
# import ------------------------------------------------------------------
# -----... | StarcoderdataPython |
1872929 | <reponame>DQinYuan/pyecharts<gh_stars>0
# coding=utf-8
from pyecharts.chart import Chart
class HeatMap(Chart):
"""
<<< 热力图 >>>
热力图主要通过颜色去表现数值的大小,必须要配合 visualMap 组件使用。
直角坐标系上必须要使用两个类目轴。
"""
def __init__(self, title="", subtitle="", **kwargs):
super(HeatMap, self).__init__(title, subt... | StarcoderdataPython |
12828944 | <gh_stars>10-100
import torch
import torch.nn as nn
from torch.optim import lr_scheduler
class HookBasedFeatureExtractor(nn.Module):
def __init__(self, submodule, layername, upscale=False):
super(HookBasedFeatureExtractor, self).__init__()
self.submodule = submodule
self.submodule.eval()
... | StarcoderdataPython |
6633788 | import re
import mock
import pytest
from dagster import HookContext, build_hook_context, failure_hook, resource, solid, success_hook
from dagster.core.definitions.decorators.hook import event_list_hook
from dagster.core.errors import DagsterInvalidInvocationError, DagsterInvariantViolationError
def test_event_list_h... | StarcoderdataPython |
1746960 | import logging
from e2e.utils.cognito_bootstrap import common
from e2e.utils.aws.acm import AcmCertificate
from e2e.utils.aws.cognito import CustomDomainCognitoUserPool
from e2e.utils.aws.route53 import Route53HostedZone
from e2e.utils.utils import print_banner, load_yaml_file
from e2e.utils.load_balancer.lb_resources... | StarcoderdataPython |
6660592 | <reponame>FadedCoder/Teeshood
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$',
views.contact_form_list, name='contact-form-list'),
url(r'^(?P<pk>[0-9]+)/$',
views.contact_form_details, name='contact-form-details'),
url(r'^(?P<pk>[0-9]+)/delete/$',
vie... | StarcoderdataPython |
4884275 | create_commodity_table = '''CREATE TABLE IF NOT EXISTS `commodity` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`unit` varchar(5) NOT NULL,
`max` decimal(7,2) NOT NULL DEFAULT '0.00',
`min` decimal(7,2) NOT NULL DEFAULT '0.00',
`avg` decimal(7,2) NOT NULL DEFAULT '0.00',
`date` dat... | StarcoderdataPython |
394371 | """
Test Exceptions
"""
import pytest
from alsek.exceptions import AlsekError
@pytest.mark.parametrize("exception", AlsekError.__subclasses__())
def test_exceptions(exception: BaseException) -> None:
try:
raise exception()
except BaseException as error:
assert isinstance(error, AlsekErr... | StarcoderdataPython |
8031944 | # New 'clean-pass' of L3HW-SF ~ usin' lessons learned
# <NAME> - 2017-May-23 02:37
#
# useful links:
# DataAugmentation:
# https://github.com/fastai/courses/blob/master/deeplearning1/nbs/lesson3.ipynb
# I forgot but reference anyway:
# https://github.com/fastai/courses/blob/master/deeplearning1/nbs/lesson2.ipynb
# Good... | StarcoderdataPython |
5045997 | from typing import List
class Solution:
def searchRange(self, nums: List[int], target: int) -> List[int]:
if not nums:
return -1, -1
res1, res2 = -1, -1
lo, hi = 0, len(nums)-1
while lo <= hi:
a = (lo + hi) // 2
if target <= nums[a]:
... | StarcoderdataPython |
12856785 | <reponame>xuantan/viewfinder<filename>backend/db/test/id_allocator_test.py
# Copyright 2011 Viewfinder Inc. All Rights Reserved.
"""Tests for IdAllocator data object.
"""
__author__ = '<EMAIL> (<NAME>)'
import unittest
from viewfinder.backend.base import util
from viewfinder.backend.base.testing import async_test
f... | StarcoderdataPython |
3510605 | # -*- coding: utf-8 -*-
SECRET_KEY = 'this is not secret...'
REMEMBER_COOKIE_NAME = 'scout_remember_me'
MONGO_DBNAME = 'scoutTest'
BOOTSTRAP_SERVE_LOCAL = True
TEMPLATES_AUTO_RELOAD = True
DEBUG_TB_INTERCEPT_REDIRECTS = False
# Flask-mail: http://pythonhosted.org/flask-mail/
# see: https://bitbucket.org/danjac/flas... | StarcoderdataPython |
11241677 | <reponame>gustavocelani/customers_gxp_heatmap
###############################################################################
#
# Filename: analyze.py
#
# Description: Parsed customers analysis.
# Usage: python3 analyze.py --customers <dataset>
#
# Version: 1.0
# Created: 25/06/2020... | StarcoderdataPython |
3290636 | <filename>babyshop_app/products/migrations/0005_rename_describtion_product_description.py
# Generated by Django 4.0.2 on 2022-02-24 05:15
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('products', '0004_category_product_category'),
]
operations = [
... | StarcoderdataPython |
8011675 | class FakeRequest:
"""
A replacement for Django's Request object. This is only used for unit
tests at the moment. If you're not using Django and need to create such
a class have a look at the source for the tests fake request class in
in tests/request.py
"""
#: Boolean, if the connection is ... | StarcoderdataPython |
11344709 | from autodoc import *
import sys
def check(got, expected, expected_builtin=None, skip=False):
if not skip:
expect = expected
if is_python_builtin() and expected_builtin != None:
expect = expected_builtin
if expect != got:
raise RuntimeError(
"\n" + "... | StarcoderdataPython |
11296311 | <reponame>kolszewska/MedTagger
"""Module responsible for definition of Auth service."""
from typing import Any
from flask import request
from flask_restplus import Resource
from medtagger.api import api
from medtagger.api.auth.business import create_user, sign_in_user
from medtagger.api.auth import serializers
auth_... | StarcoderdataPython |
9713404 | <filename>src/ebay_rest/api/commerce_taxonomy/models/category_tree_node.py
# coding: utf-8
"""
Taxonomy API
Use the Taxonomy API to discover the most appropriate eBay categories under which sellers can offer inventory items for sale, and the most likely categories under which buyers can browse or search for i... | StarcoderdataPython |
9726881 | <filename>stubs.min/System/Windows/Forms/__init___parts/ToolStripItemTextRenderEventArgs.py<gh_stars>1-10
class ToolStripItemTextRenderEventArgs(ToolStripItemRenderEventArgs):
"""
Provides data for the System.Windows.Forms.ToolStripRenderer.RenderItemText event.
ToolStripItemTextRenderEventArgs(g: Graphics,i... | StarcoderdataPython |
3230889 | <gh_stars>1-10
import matplotlib.pyplot as plt
year = []
dataset1 = []
dataset2 = []
startYear = int(input("Input the starting year: "))
endYear = int(input("Input the ending year: "))
for i in range(startYear, endYear+1):
data1 = float(input("Input the data value for Dataset 1 in " + str(i) + ": "))
data2 = floa... | StarcoderdataPython |
9666161 | import unittest
from typing import NoReturn
from tests.common import *
from ddns_manager.ddns_updater import DDNSUpdater
class TestDDNSUpdater(unittest.TestCase):
def test_get_current_ip_signature(self):
# test if DDNSUpdater has the method update_ddns_record and if that has the correct signature
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.