id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1617451 | import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], ".."))
from mabel.adapters.minio import MinIoWriter, MinIoReader
from mabel.operators.minio import MinIoBatchWriterOperator
from mabel.data import BatchWriter
from mabel.data import Reader
from rich import traceback
traceback.install()
BUCKET_NAME = ... | StarcoderdataPython |
1738389 | <gh_stars>10-100
# Copyright (c) 2008 <NAME> http://coredumped.org/
#
# 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
# without limitation the rights to use, co... | StarcoderdataPython |
93477 | <filename>predictKappa/backend/kappa_tools.py<gh_stars>0
import re
from predictKappa.kappa_exceptions import KappaError
def write_csv(input_dict, output_file):
"""
Function that writes the scores in an input dictionary out to a standardized CVS file format.
Parameters
-----------
input_dict : d... | StarcoderdataPython |
24004 | <reponame>brettcannon/release-often<gh_stars>1-10
import json
from unittest import mock
import gidgethub.abc
import pytest
from release_often import __main__ as main
class TestMatchingPR:
@pytest.mark.asyncio
async def test_pr_found(self, data_path):
"""Test when a PR number is specified in the init... | StarcoderdataPython |
1696931 | <reponame>soumikmohianuta/pixtoapp
from Rules.ASingleRule import ASingleRule
from Utils import ColorUtil
from RectUtils import RectUtil
from Rules.TextValidator import TextValidator
from Utils import Constants
from ocr.OCRTextWrapper import OCRTextWrapper
from Utils import GroupUtil
from Utils import TextUtils
from Uti... | StarcoderdataPython |
3235195 | <filename>basics/py/06_01_print_string.py<gh_stars>0
# 文字列
print('this is a pen.')
string = 'this is a pen from variable.'
print(string)
# シングルクオートでもダブルクオートでも問題ない
print("this is a pen in double quote.")
| StarcoderdataPython |
3365537 | <filename>examples/LSTM/trainLSTM.py
import os
from optparse import OptionParser
# Command line options
parser = OptionParser()
parser.add_option("-l", "--loadModel", action="store_true", dest="loadModel", default=False, help="Load model")
parser.add_option("--useRMS", action="store_false", dest="useRMS", default=True... | StarcoderdataPython |
1641454 | import web3
import web3.contract
from lib import w3
from ChunkedFilesValidator import VALIDATOR_ABI, VALIDATOR_SOL
import math
from Crypto.Hash import keccak
import os
import pickle
import random
class Solver:
CHUNK_SIZE = 10
@staticmethod
def init_validator(address):
ValidatorCon... | StarcoderdataPython |
54948 | # -*- coding: utf-8 -*-
def __setitem__(self, key, value):
"""Called to implement assignment to self[key]."""
if isinstance(value, tuple):
self._statements.__setitem__(key, value[0])
if len(tuple) >= 1:
self._comments.__setitem__(key, value[1])
else:
self._comme... | StarcoderdataPython |
4814543 | <filename>ord_schema/scripts/check_pb_test.py
# Copyright 2020 Open Reaction Database Project Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... | StarcoderdataPython |
175464 | from .models import print_image_classifiers, image_classifier
from .models import print_image_regression_models, image_regression_model
from .data import show_image, show_random_images, preview_data_aug, get_data_aug
from .data import images_from_folder, images_from_csv, images_from_array, images_from_fname, preprocess... | StarcoderdataPython |
121384 | import pynini
import tqdm
class Alphabet:
"""
Represents mapping between phonemes in IPA
and representations in text files
"""
def __init__(self):
self.symbols
class Vocabulary:
"""
Get ...
"""
class Allophony:
"""
Multiplies the vocabulary by ta... | StarcoderdataPython |
3359414 | <filename>hard-gists/1160696/snippet.py
import base64
from myapplication import app
class MyTestCase(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
def tearDown(self):
pass
def open_with_auth(self, url, method, username, password):
return self.app.open(u... | StarcoderdataPython |
3248540 | #!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
import discord
from discord.ext import commands
import random
import math
class CombatInfo:
BODY_LOCATIONS = [
"Left Leg",
"Head",
"Torso",
"Torso",
"Torso",
"Torso",
"Right Arm",
"Lef... | StarcoderdataPython |
1782970 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import cv2
import time
import numpy as np
import matplotlib.pyplot as plt
import scipy.fftpack
from cv2 import cv
from atx.record.monkey import Monkey, StupidMonkey, RandomContourMonkey
from atx.drivers.android_minicap import AndroidDeviceMinica... | StarcoderdataPython |
1659527 | # chat/routing.py
from django.urls import re_path
from . import consumers
websocket_urlpatterns = [
re_path(r"asgi/notifications/$", consumers.NotificationsConsumer),
]
| StarcoderdataPython |
3260136 | <reponame>jastrauss/SheetReader<gh_stars>1-10
"""
An example of using SheetReader to read the names in a
Google Spreadsheet and write back a greeting.
"""
from SheetReader import SheetReader
workbook_id = '' # The ID of the workbook, https://docs.google.com/spreadsheets/d/THIS_STRING_IS_THE_WORKBOOK_ID/edit
s... | StarcoderdataPython |
1715210 | <filename>test.py<gh_stars>0
import cv2
import os
# This will return video from the first webcam on your computer.
cap = cv2.VideoCapture(0)
# Define the codec and create VideoWriter object
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
out = cv2.VideoWriter(os.path.join("./video", 'output.avi'), fourcc, 20.0, (640, 480))... | StarcoderdataPython |
47649 | import torch
import torch.nn as nn
class CMT(nn.Module):
def __init__(self,
stem_channels: list):
super(CMT, self).__init__()
self.stem
def forward(self, x):
pass
| StarcoderdataPython |
1668914 | ###############################################################################
# -*- coding: utf-8 -*-
# Order: A tool to characterize the local structure of liquid water
# by geometric order parameters
#
# Authors: <NAME>
#
# Released under the MIT License
###################################################... | StarcoderdataPython |
4816715 | <filename>lino_xl/lib/reception/models.py
# -*- coding: UTF-8 -*-
# Copyright 2013-2017 <NAME>
#
# License: BSD (see file COPYING for details)
"""The :xfile:`models.py` file for `lino_xl.lib.reception`.
This injects three fields to :class:`cal.Guest
<lino_xl.lib.cal.models.Guest>` and defines three new states in
:cla... | StarcoderdataPython |
3387836 | """Tests for the Abode config flow."""
from unittest.mock import patch
from abodepy.exceptions import AbodeAuthenticationException
from abodepy.helpers.errors import MFA_CODE_REQUIRED
from openpeerpower import data_entry_flow
from openpeerpower.components.abode import config_flow
from openpeerpower.components.abode.c... | StarcoderdataPython |
3222313 | <reponame>fangxingli/mambari
#!/usr/bin/env python
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License... | StarcoderdataPython |
173986 | # pylint: disable=redefined-outer-name
"""Test Configuration and Fixtures.
Setup test config_setup.cfg.configurations and store fixtures.
Returns:
[type]: None.
"""
import configparser
import os
import pathlib
import shutil
import typing
import cfg.glob
import cfg.setup
import db.driver
import pytest
import sqla... | StarcoderdataPython |
3396392 | <reponame>chyidl/chyidlTutorial
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# ____
# / . .\
# Life is short \ ---<
# I use Python \ /
# __________/ /
# -=:___________/
# redis_migrate.py
# PythonAwesomeScript
#
# Created by <NAME> on 06/12/19 15:59.
# Copyright © 2019. <NAME>... | StarcoderdataPython |
51300 | #! /usr/bin/python3
# monitoring for expressvpn and restarting the connection everytime it wigs out
from os import environ
from time import sleep
from shutil import copyfile
from sys import exit
import subprocess, pexpect
def check_location(loc):
"""Makes sure the location is valid. I'm just going to list the big... | StarcoderdataPython |
3387626 | # Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
import abc
from python_toolbox import misc_tools
from .context_manager import ContextManager
class DelegatingContextManager(ContextManager):
'''
Object which delegates its context manager interface to another object.
Yo... | StarcoderdataPython |
1768783 | soma = 0
for c in range (0,6):
n = int(input("Digite um valor: "))
if n % 2 == 0:
soma = soma + n
print('A soma dos valores é {}'.format(soma))
| StarcoderdataPython |
1645647 | <filename>test/test_markdown_emphasis_rule_10.py<gh_stars>0
"""
https://github.github.com/gfm/#emphasis-and-strong-emphasis
"""
import pytest
from .utils import act_and_assert
@pytest.mark.gfm
def test_emphasis_431():
"""
Test case 431: (part 1) Any nonempty sequence of inline elements can be the contents o... | StarcoderdataPython |
10323 | #encoding:utf-8
from utils import weighted_random_subreddit
t_channel = '@news756'
subreddit = weighted_random_subreddit({
'politics': 0.5,
'news': 0.5
})
def send_post(submission, r2t):
return r2t.send_simple(submission,
text='{title}\n\n{self_text}\n\n/r/{subreddit_name}\n{short_link}',
... | StarcoderdataPython |
12567 | <reponame>kawa-work/deepmind-research
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Un... | StarcoderdataPython |
147873 | <reponame>kyasui/store<filename>saleor/checkout/__init__.py<gh_stars>0
from collections import defaultdict
from django.conf import settings
from prices import Price
from satchless.process import ProcessManager
from satchless.item import Partitioner
from .steps import (BillingAddressStep, ShippingStep, DigitalDelivery... | StarcoderdataPython |
3252028 | <filename>tests/test_merge_sort.py
# coding=utf-8
from algorithms.merge_sort import MergeSort
def test_merge_sort(arrays):
obj = MergeSort()
for array in arrays:
sorted_array = sorted(array)
assert obj.sort(array) == sorted_array
| StarcoderdataPython |
1764074 | """This module contains the general information for BiosVfConfigTDPLevel ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class BiosVfConfigTDPLevelConsts:
VP_CONFIG_TDPLEVEL_LEVEL_1 = "Level 1"
VP_CONFIG_TDPLEVEL_LEVEL_... | StarcoderdataPython |
24320 | """Class implementation for the stop_propagation interface.
"""
from apysc._type.variable_name_interface import VariableNameInterface
class StopPropagationInterface(VariableNameInterface):
def stop_propagation(self) -> None:
"""
Stop event propagation.
"""
import apys... | StarcoderdataPython |
88681 | # --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... | StarcoderdataPython |
1728541 | from pathlib import Path
from typing import List
from matplotlib import pyplot as plt
from paddle.custom_types import AnyPath
from paddle.visualization import plot_particle_size_distributions, save_figure
from utilities.particle_size_distribution_comparison import (
gather_psd_data_for_class,
get_data_sets,
... | StarcoderdataPython |
5731 | <filename>awx/plugins/library/scan_services.py
#!/usr/bin/env python
import re
from ansible.module_utils.basic import * # noqa
DOCUMENTATION = '''
---
module: scan_services
short_description: Return service state information as fact data
description:
- Return service state information as fact data for various se... | StarcoderdataPython |
91979 | # Generated by Django 3.1.4 on 2020-12-05 12:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0039_auto_20201205_1218'),
]
operations = [
migrations.RemoveField(
model_name='post',
name='postImage',
... | StarcoderdataPython |
1767374 | <reponame>jniemenmaa/cyris
#!/usr/bin/python
import yaml
import os
import re
from storyboard import Storyboard
# List of range ids that are forbidden to use:
# * 127 => overlap with loopback address if used for cyber range: 127.1.1.2 etc.
FORBIDDEN_ID_LIST = {127}
FLAG = True
DEBUG = False
def raise_flag(error):
... | StarcoderdataPython |
3340568 | <filename>db_contexts/context_base.py
from sqlalchemy import create_engine
from sqlalchemy.orm import Session
class DbContext:
def __init__(self, addr: str):
self.__engine = create_engine(addr, echo=False)
def new_session(self, f):
def wapper(*args, **kwargs):
with self.Session() ... | StarcoderdataPython |
4822349 | #! /usr/bin/python
from docassemble import Interview
interview = Interview("tests/testinterview/questions.yml")
interview.assemble()
| StarcoderdataPython |
1680192 | <reponame>havi121/testinga1230
from astropy import units as u
from poliastro.core.sensors import (
ground_range_diff_at_azimuth as ground_range_diff_at_azimuth_fast,
min_and_max_ground_range as min_and_max_ground_range_fast,
)
@u.quantity_input(h=u.au, eta_fov=u.rad, eta_center=u.rad, R=u.au)
def min_and_max... | StarcoderdataPython |
115407 | import unittest
import xr
class TestBool(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_bool(self):
self.assertTrue(True)
self.assertFalse(False)
self.assertTrue(xr.TRUE)
self.assertFalse(xr.FALSE)
self.assertTrue(xr.B... | StarcoderdataPython |
3264155 | <gh_stars>0
import argparse
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.lines import Line2D
import numpy as np
from astropy.io import fits
from astropy.modeling.models import Linear1D
from astropy.modeling.fitting import LinearLSQFitter
from miri_ramp_utils import get_ramp, get_good_ramp,... | StarcoderdataPython |
1665791 | <gh_stars>0
import clamato_read
import cuts
import milkyway
import prep
import bootstrap
import numpy as np
#grab the spectra
spec, red, coord = clamato_read.xspec([2.25,2.75])
print("---------CLAMATO data read in--------")
#cut the sample
spec, red, coord = cuts.lyman_limit(spec, red, coord)
spec, red, coord = cuts... | StarcoderdataPython |
3234506 | <filename>coroutine/try_aio_3th.py
#!/user/bin/env python
# -*-coding:utf-8 -*-
# @CreateTime : 2022/1/25 10:02
# @Author : xujiahui
# @Project : robust_python
# @File : try_aio_3th.py
# @Version : V0.0.1
# @Desc : 文件异步IO
import asyncio
import concurrent.futures
async def main():
... | StarcoderdataPython |
3241116 | from sklearn.ensemble import GradientBoostingClassifier
from commons import variables
from commons import tools
from scipy.stats import mode
def learn(x, y, test_x):
# set sample weight
weight_list = []
for j in range(len(y)):
if y[j] == "0":
weight_list.append(variables.weight_0_gdb... | StarcoderdataPython |
4828015 | <gh_stars>0
# -*- coding: utf-8 -*-
"""Tests for the ``calculation launch neb`` command."""
import pytest
from aiida_quantumespresso.cli.calculations.neb import launch_calculation
@pytest.mark.usefixtures('clear_database_before_test')
def test_command_base(run_cli_process_launch_command, fixture_code, generate_upf_f... | StarcoderdataPython |
3283279 | from sympy.utilities.exceptions import SymPyDeprecationWarning
from sympy.core.basic import Basic
from sympy.core.compatibility import range, Callable
from sympy.core.cache import cacheit
from sympy.core import S, Dummy, Lambda
from sympy import symbols, MatrixBase, ImmutableDenseMatrix
from sympy.solvers import solve
... | StarcoderdataPython |
135580 | from .checks import check_unique_service_names, check_env_file_exists
from .cli import cli
def main() -> None:
try:
check_unique_service_names()
check_env_file_exists()
except RuntimeError as e:
print(e)
exit(1)
cli()
main()
| StarcoderdataPython |
62813 | <gh_stars>0
from skimage import measure
import numpy as np
from brainio import brainio
def marching_cubes_to_obj(marching_cubes_out, output_file):
"""
Saves the output of skimage.measure.marching_cubes as an .obj file
:param marching_cubes_out: tuple
:param output_file: str
"""
verts, faces... | StarcoderdataPython |
3339003 | <reponame>metricq/metricq-python
# Copyright (c) 2018, ZIH,
# Technische Universitaet Dresden,
# Federal Republic of Germany
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistribut... | StarcoderdataPython |
3324750 | import os
import sys
from qtpy.QtCore import QProcess, QProcessEnvironment, Qt
from qtpy.QtWidgets import (
QDialog,
QHBoxLayout,
QLabel,
QLineEdit,
QPushButton,
QTextEdit,
QVBoxLayout,
)
from ..utils._appdirs import user_plugin_dir, user_site_packages
from ..utils.misc import running_as_b... | StarcoderdataPython |
3266378 | # Databricks notebook source
# Computational and Visualisation Packages
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from ggplot import *
# Pyspark Packages
from pyspark.sql import functions as F
from pyspark.sql.functions import col, desc, trim
from pyspark.sql.types im... | StarcoderdataPython |
84357 | # -*- coding: utf-8 -*-
from .models import *
from .attention import *
from utils.infolog import log
import numpy as np
from utils.audio import inv_linear_spectrogram_tensorflow
class Centaur:
"""Centaur Feature prediction Model.
"""
def __init__(self, params):
self.params = params
self.... | StarcoderdataPython |
48143 | from colorhash import ColorHash
from discord import Embed, Colour
from requests import get
from ics import Calendar
import arrow
URL = "https://cloud.timeedit.net/chalmers/web/public/ri6Y73QQZ55Zn6Q14854Q8Z85640y.ics"
def get_timeline():
c = Calendar(get(URL).text)
return c.timeline
def day(offset):
"""... | StarcoderdataPython |
31552 | #!/usr/bin/env python
import os, sys, argparse, errno, yaml, time, datetime
import rospy, rospkg
import torch, torchvision, cv2
import numpy as np
from rosky_msgs.msg import WheelsCmdStamped, Twist2DStamped
from img_recognition.msg import Inference
from cv_bridge import CvBridge, CvBridgeError
from jetcam_ros.utils imp... | StarcoderdataPython |
183752 | """
Defines the base API for the property estimator task calculation backend.
"""
import re
from enum import Enum
from propertyestimator import unit
class ComputeResources:
"""An object which stores how many of each type of computational resource
(threads or gpu's) is available to a calculation worker.
... | StarcoderdataPython |
3275884 | import os
import h5py
import math
import copy
from tqdm import tqdm
import torch
import torch.nn as nn
import itertools
from torch.utils.data import DataLoader
import torch.optim as optim
from torch.utils.tensorboard import SummaryWriter
import numpy as np
import skimage.io as skio
import utils.io as io
from utils.con... | StarcoderdataPython |
45230 | <reponame>flairmix/tg_bot_coffee<filename>main.py
from replit import db
import os
import telebot
from datetime import date, timedelta
API_KEY = os.getenv('API_KEY')
bot = telebot.TeleBot(API_KEY)
@bot.message_handler(commands=['help'])
def help(message):
str_output = "Привет, маленький беспомощный любитель кофе!... | StarcoderdataPython |
4817289 | import sys
try:
import twisted
except ImportError:
raise SystemExit("twisted not found. Make sure you "
"have installed the Twisted core package.")
from distutils.core import setup
def refresh_plugin_cache():
from twisted.plugin import IPlugin, getPlugins
list(getPlugins(IPlugin... | StarcoderdataPython |
1653999 | import tensorflow as tf
import pandas as pd
import numpy as np
import os
from sklearn.linear_model import LogisticRegression
import sys
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score
import warnings
import pickle
import pandas as pd
warnings.simplefilter('ignore', category=Warning, lineno=0, appe... | StarcoderdataPython |
1716291 | <reponame>vicfb/RoboDK-Files
import serial
#Write the program name here
ProgName = b'TEST'
#Write the positions here
def Position_List():
positionNoFlag('P1', [426.393,-0.000,460.000,0.000,90.000,-0.000])
positionFlag('P2', [242.630,0.000,685.411,-0.000,52.760,-0.000],[6,0])
#ser = serial.S... | StarcoderdataPython |
183451 | import traceback
from discord.ext import commands
from .errors import *
class CommandErrorHandler:
def __init__(self, bot):
self.bot = bot
async def on_command_error(self, error, context):
ignored = (commands.CommandNotFound)
public = (commands.BadArgument, commands.MissingRequiredAr... | StarcoderdataPython |
73523 | <filename>rf.py
#! python2
# coding: utf-8
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier as RF
from sklearn.model_selection import train_test_split
def run(x, y, test_size=0.6):
x_train, x_test, y_train, y_test = train_test_split(
x, y, test_size=test_size, ran... | StarcoderdataPython |
3271168 | <gh_stars>1-10
from keras.optimizers import SGD
def create(config):
config.define('optimizer.sgd.lr', type=float, default=1e-2)
config.define('optimizer.sgd.momentum', type=float, default=0.)
config.define('optimizer.sgd.decay', type=float, default=0.)
config.define('optimizer.sgd.nesterov', type=int,... | StarcoderdataPython |
179324 | from flask import Flask, request, url_for, redirect, render_template, jsonify, abort
import pandas as pd
import pickle
import numpy as np
import json
from sklearn.preprocessing import StandardScaler
app = Flask(__name__)
model = pickle.load(open('model.pkl', 'rb'))
cols = ['ph', 'Hardness', 'Solids', 'Chloramines', '... | StarcoderdataPython |
1730330 | <gh_stars>0
"""
This script generates a bytearray for badchar detection
and is similar to mona.py's bytearray function.
Usage:
Create bytearray.txt and bytearray.bin (0-255)
$ python bytearray.py
Create bytearray.txt and bytearray.bin and exclude chars
$ python bytearray.py '\x00\x0a'
"""
import sys... | StarcoderdataPython |
52922 | <gh_stars>1-10
from gym.spaces import Box
from gym.wrappers import TransformObservation
class NormalizeObservationSpace(TransformObservation):
def __init__(self, env, f):
super(NormalizeObservationSpace, self).__init__(env, f)
if isinstance(self.observation_space, Box):
self.observation_... | StarcoderdataPython |
3303082 | <reponame>lzpsgh/AscTrio<filename>api/clk_clock_audit.py
# -*- coding: utf-8 -*-
# @Time : 2021/4/6
# 模版文件,仅供参考
from base.base_request import BaseRequest
from util import assert_util
from util import auth_util
from util import common_util
from util.data_util import data_pool
'''
用前须知:
1. 关于 req_body
不管是get请求的param... | StarcoderdataPython |
82705 | <filename>src/linearAlgebra/matrix/shape.py
def shape(A):
num_rows = len(A)
num_cols=len(A[0]) if A else 0
return num_rows, num_cols
A=[
[1,2,3],
[3,4,5],
[4,5,6],
[6,7,8]
]
print(shape(A))
| StarcoderdataPython |
1643145 | from keygen.crypto_coin_factory import CoinFactory
def get_coin_address(currency, private_key):
service = CoinFactory().get_coin_service(currency)
return service.get_address(private_key)
def test_get_address_btc():
address = get_coin_address('BTC', 'L2H1WVjswTKz8USEvyii8aSt5ZNMjMkHT6A9QVg8CTQ4NUBCQikS')... | StarcoderdataPython |
3357930 | <filename>gen/utils/replay_json.py<gh_stars>0
import json
def replay_json(env, json_file):
# load json data
with open(json_file) as f:
traj_data = json.load(f)
# setup
scene_num = traj_data['scene']['scene_num']
object_poses = traj_data['scene']['object_poses']
dirty_and_empty = traj_d... | StarcoderdataPython |
3359310 | import graphene
from django.utils.text import slugify
from ....channel.error_codes import ChannelErrorCode
from ...tests.utils import assert_no_permission, get_graphql_content
CHANNEL_UPDATE_MUTATION = """
mutation UpdateChannel($id: ID!,$input: ChannelUpdateInput!){
channelUpdate(id: $id, input: $input){... | StarcoderdataPython |
4839880 | <reponame>niki4/leetcode_py3<filename>medium/082_remove_duplicates_from_sorted_list_ii.py
"""
Given a sorted linked list, delete all nodes that have duplicate numbers,
leaving only distinct numbers from the original list.
Example 1:
Input: 1->2->3->3->4->4->5
Output: 1->2->5
Example 2:
Input: 1->1->1->2->3
Output: ... | StarcoderdataPython |
1614393 | def _carve(string):
return str(string).title()
def _split(string, delimitter, index):
sub_strings = string.split(delimitter)
return sub_strings[index]
def _concat(*args):
return args
def _concat_ws(*args):
return args
def _regex_split(column, pattern, index):
return column, pattern, inde... | StarcoderdataPython |
3340216 | from rlbench.environment import Environment
from rlbench.action_modes import ArmActionMode
from rlbench.observation_config import ObservationConfig
from rlbench.observation_config import CameraConfig
from rlbench.sim2real.domain_randomization import RandomizeEvery
from rlbench.sim2real.domain_randomization import Visua... | StarcoderdataPython |
82713 | #
# Copyright (C) 2014-2016 UAVCAN Development Team <uavcan.org>
#
# This software is distributed under the terms of the MIT License.
#
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
from __future__ import division, absolute_import, print_function, unicode_literals
import os
import dronecan
from dronecan.tr... | StarcoderdataPython |
1677978 | <filename>sroka/api/ga/ga.py
import os
import pandas as pd
from google.auth.exceptions import RefreshError
from googleapiclient import discovery
from googleapiclient.errors import HttpError
import sroka.config.config as config
def get_first_profile_id(service):
accounts = service.management().accounts().list()... | StarcoderdataPython |
3262011 | <gh_stars>1-10
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from .encoder import Encoder
from src.modules.nn_layers import *
from src.utils.args import args
class DensenetEncoder(Encoder):
def __init__(self, output_dim, input_shape):
super().__init__()
nc = inp... | StarcoderdataPython |
1783058 | <reponame>taoyichen/CS110-Assignments-Python<gh_stars>0
from patron import *
from book import *
from library import *
#from patronStudentVersion import *
#from bookStudentVersion import *
#from libraryStudentVersion import *
from librarymodule import *
# This is a tester for the Library class
# Note that it uses the P... | StarcoderdataPython |
183729 | from .POSTGRESQL_connection import * | StarcoderdataPython |
1632156 | <reponame>samuel-velez/-533_lab_4_KatheVelez<gh_stars>0
# Main package
## Upload your own data or choose a practice dataset from Seaborn.
import sklearn as skl
import scipy
import matplotlib
import pandas as pd
import seaborn as sns
def load_csv(file_path):
data = pd.read_csv(file_path)
return "Data loaded"
d... | StarcoderdataPython |
3292346 | <filename>Bank/DeleteAccount.py
import pymysql
from PyQt5.QtWidgets import QWidget, QMessageBox
from PyQt5.QtCore import QDate, Qt
from DELETE_ACCOUNT import Ui_Form
class delete_account(QWidget):
def __init__(self):
super(delete_account, self).__init__()
self.ui = Ui_Form()
self.ui.setupUi... | StarcoderdataPython |
1682117 | """
Unit tests for :class:`fiftyone.core.stages.SelectObjects` and
:class:`fiftyone.core.stages.ExcludeObjects`.
| Copyright 2017-2021, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
import random
import unittest
import fiftyone as fo
import fiftyone.core.dataset as fod
import fiftyone.zoo as foz
class... | StarcoderdataPython |
3331976 | <gh_stars>0
import sys
import os
import json
from twilio.rest import Client
def enviarMensage(client, recipient_number, recipient_name, myPhone):
mensaje = """
Hola {}, este es un msg de binvenida.
Que tengas un excelente dia.
Nos vemos pronto.""".format(recipient_name)
try:
m... | StarcoderdataPython |
1675565 | <filename>ramp_rate_optimization.py
"""
Copyright (c) 2021, Electric Power Research Institute
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the ... | StarcoderdataPython |
1639462 | import sys
import os
ispy3 = sys.version_info[0] == 3
iswin = os.name == 'nt'
kwargs = {}
scripts = ["flake8/flake8"]
if ispy3:
from distutils.core import setup # NOQA
if iswin:
scripts.append("scripts/flake8.cmd")
else:
try:
from setuptools import setup # NOQA
kwargs = {
... | StarcoderdataPython |
3321754 | # The MIT License (MIT)
#
# Copyright (c) 2015 <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 without limitation the rights
# to use, copy, ... | StarcoderdataPython |
1709412 | <reponame>zimoqingfeng/landmark-retrieval-challenge-test
import os
import numpy as np
from PIL import Image
import torch
import torchvision.transforms as transforms
class ImgLoader:
def __init__(self, dir_images):
self.dir_images = dir_images
self.to_tensor = transforms.ToTensor()
self.... | StarcoderdataPython |
1752335 | from api_insee.utils.client_credentials import ClientCredentials
from api_insee.utils.client_token import ClientToken
from api_insee.request.request_token import RequestTokenService
class AuthService():
token = None
def __init__(self, key=False, secret=False):
self.credentials = ClientCredentials(
... | StarcoderdataPython |
4837737 |
bind = '0.0.0.0:8080'
workers = '10'
errorlog = 'logs/gunicorn.log'
timeout = '240'
| StarcoderdataPython |
11127 | <reponame>mogad0n/Limnoria
###
# Copyright (c) 2020-2021, The Limnoria Contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above cop... | StarcoderdataPython |
3275999 | <reponame>BobbyEllena/bugtracker<gh_stars>0
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from bug.models import BugModel, CustUser
from bug.forms import LoginForm, CreateUser
# Register your models here.
class CustomUserAdmin(UserAdmin):
add_form = CreateUser
form = Create... | StarcoderdataPython |
1765539 |
class TokenGenerator(object):
token_separator = ':'
component_separator = '.'
def __init__(self, component, module):
self._component = component
self._module = module
self._tag_prefix = self.component_separator.join([self._component, self._module]) + self.token_separator
... | StarcoderdataPython |
3330793 | import string
# Ceaser Cipher
# plain text: A B C D.... (if key is 3) || ascii value: 65, 66, 67, 68
# cipher text: D E F G (adding the key to the ascii value) || ascii value: 68, 69, 70, 71
class CaeserCipher:
def __init__(self, key=3):
self.key = key%26 # whatever the key value it is append to th... | StarcoderdataPython |
1778939 | <gh_stars>0
# coding=utf-8
''' mapper of pangerank algorithm'''
import sys
import numpy as np
import os
sys.path.append('/home/dsjxtjc/2018211149/')
from mapreduce.map_reduce import partition, combine, finish
def map(string_data_path, reduce_num, map_id):
id1 = id2 = None
heros = value = None
count1 = ... | StarcoderdataPython |
193168 | <reponame>sympolite/pridebot<filename>src/pridebot_v1_1.py<gh_stars>1-10
#=============================================================
#PRIDE BOT 1.1
#by sympolite
#github.com/sympolite
#femme pride flag by noodle.tumblr.com
#=============================================================
#core modules
import random
im... | StarcoderdataPython |
1764350 | import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from app import app
column1 = dbc.Col(
[
dcc.Markdown(
"""
## Insights
The figure below shows ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.