id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
177970
# implementing RNN and LSTM # %% import pandas as pd import numpy as np import nltk import sklearn import matplotlib.pyplot as plt import re import tqdm twitter_df = pd.read_csv('twitter_train.csv') twitter_df = twitter_df.fillna('0') twitter_df_test = pd.read_csv('twitter_test.csv') twitter_df_test = twitter_df_tes...
StarcoderdataPython
1742575
<reponame>skimbrel/strowger<gh_stars>1-10 import re from mock import Mock, patch from nose.tools import assert_equal from nose.tools import assert_is_instance from unittest import TestCase from flask import request from twilio import twiml from strowger import switch TEST_TWILIO_REQUEST_DATA = { 'From': '+141555...
StarcoderdataPython
86096
import pip_setup pip_setup.install("moviepy") pip_setup.install("pygame") import Menu import pygame from moviepy.editor import * import random from Settings import * from Sprites import * from Menu import * import time import numpy as np class GAME : def __init__(self): #GAME ~initiali...
StarcoderdataPython
3270093
<reponame>l3l3l/vulnman from vulnman.settings import BASE_DIR # Application definition INSTALLED_APPS = [ # keep before django.contrib.admin 'dal', 'dal_select2', 'queryset_sequence', 'dal_queryset_sequence', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes',...
StarcoderdataPython
3363660
<filename>hive/__init__.py # -*- coding: utf-8 -*- from .hive import Hive __version__ = '0.10'
StarcoderdataPython
111671
<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from ibeis import constants as const from ibeis.control.accessor_decors import (adder, getter_1to1, ider) import utool as ut from ibeis.control.controller_inject import make_ibs_register_decorator print, rrr, profile...
StarcoderdataPython
90330
import sys import time import pygame from gen_new_updated_file import gen_file, format_prog registers = [0] * 128 main_reg = 0 where_in_regs = 0 should_replace = False replace_with = None with open('data.py', 'r') as f: commands_dict = eval(f.read()) pygame.init() screen = pygame.display.set_mode((512, 512)) w...
StarcoderdataPython
4809265
<reponame>Dmunch04/SquareIt import json from Objects import Notification as Notif from Modding import Mod as ModObject class Loader: def __init__ (self): self.Mods = [] self.Data = {} def Load (self, _Mod): """ Prepare the mod """ with open (_Mod, 'r') as ModFile: ...
StarcoderdataPython
1728262
from odd_models.models import DataEntity, DataSet, DataEntityType from oddrn_generator import SnowflakeGenerator from . import ( MetadataNamedtuple, _data_set_metadata_schema_url, _data_set_metadata_excluded_keys, ColumnMetadataNamedtuple, ) from .columns import map_column from .metadata import append_...
StarcoderdataPython
3349298
# BSD Licence # Copyright (c) 2009, Science & Technology Facilities Council (STFC) # All rights reserved. # # See the LICENSE file in the source distribution of this software for # the full license text. # Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). # This software may be distributed un...
StarcoderdataPython
1601618
import torch from .torchpoints import ball_query_partial_dense import numpy as np import numba from typing import List @numba.jit(nopython=True) def _grow_proximity_core(neighbours, min_cluster_size): num_points = int(neighbours.shape[0]) visited = np.zeros((num_points,), dtype=numba.types.bool_) clusters...
StarcoderdataPython
3362128
<reponame>VisionSystemsTech/projects-time # -*- coding: utf-8 -*- import yaml from copy import deepcopy from pathlib import Path from easydict import EasyDict class SingletonMeta(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: instance = super()._...
StarcoderdataPython
3368123
<reponame>mahmuuud/pip-accel # Extension of pip-accel that deals with dependencies on system packages. # # Author: <NAME> <<EMAIL>> # Last Change: October 31, 2015 # URL: https://github.com/paylogic/pip-accel """ System package dependency handling. The :mod:`pip_accel.deps` module is an extension of pip-accel that de...
StarcoderdataPython
1751851
# -*- coding: utf-8 -*- def __len__(self): """Method to behave like a dict and the number of keys""" return self._statements.__len__()
StarcoderdataPython
3372024
<filename>backend/shared/shared/azure_adfs/urls.py from django.urls import include, path, re_path from shared.azure_adfs.views import HelsinkiOAuth2CallbackView urlpatterns = [ re_path(r"^callback$", HelsinkiOAuth2CallbackView.as_view(), name="callback"), path("", include("django_auth_adfs.urls")), ]
StarcoderdataPython
4823522
""" Дан список. Определите, является ли он монотонно возрастающим(то есть верно ли, что каждый элемент этого списка больше предыдущего).Выведите YES, если массив монотонно возрастает и NO в противном случае.Решение оформите в виде функции IsAscending(A).В данной функции должен быть один цикл while, не содержащий вложен...
StarcoderdataPython
194129
<filename>tests/test_4_delete_test_db.py import os db_path = 'tests/processed/test_db.sqlite' def test_delete_test_db(): #This should always be the last script run. This will delete the test db created to avoid appending onto it on future tests os.remove(db_path)
StarcoderdataPython
1765089
<reponame>acse-zh820/ci_acse1 import pytest from simple_functions import my_sum, factorial, average class TestSimpleFunctions(object): '''Class to test our simple functions are working correctly''' @pytest.mark.parametrize('iterable, expected', [ ([8, 7, 5], 20), ((10, -2, 5, -10, 1), 4) ...
StarcoderdataPython
4802326
from setuptools import setup, find_packages with open('README.md') as f: readme = f.read() with open('LICENSE') as f: license_ = f.read() setup( name='econ_watcher_reader', version='0.0.1', description='Web scraper to get economy watcher data from Cabinet Office of Japan.', long_description=...
StarcoderdataPython
4823292
<gh_stars>10-100 import os import time import torch as T import numpy as np import json import queue import importlib import multiprocessing as mp from collections import namedtuple from .utils.plot import smoothed_plot from .utils.replay_buffer import ReplayBuffer, PrioritisedReplayBuffer from .utils.normalizer import...
StarcoderdataPython
1785093
<reponame>binhmuc/gluon-ts<filename>test/model/naive_predictors/test_r_code_compliance_of_naive_2.py<gh_stars>1-10 # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the Licen...
StarcoderdataPython
1772715
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns mean_sigma = pd.read_csv("mean_sigma.csv") sns.set(style='ticks', context='talk') plt.rcParams['font.family'] = 'serif' plt.rcParams['font.weight'] = 'normal' plt.rcParams['legend.title_fontsize'] = 24 groups = mean_sigma.groupby("algorithm") ...
StarcoderdataPython
1689215
<reponame>CiscoSystems/networking-cisco # Copyright 2015 Cisco Systems, 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 # # http://www.apache.org/l...
StarcoderdataPython
3339183
<filename>core/migrations/0019_auto_20181106_2345.py # Generated by Django 2.1.3 on 2018-11-06 10:45 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0018_auto_20181106_2343'), ] operations = [ migrations.AddField( mo...
StarcoderdataPython
1778050
<filename>exercicio 031.py<gh_stars>1-10 #Desenvolva um programa que pergunte a distância de uma viagem em km. #Calcule o preço da passagem, cobrando R$0,50 por km rodado para viagens #de até 200km e R$0,45 para viagens mais longas. dist = float(input('Qual a distancia em km a percorrer? ')) d1 = dist * 0.50 ...
StarcoderdataPython
905
from typing import Dict, Optional, List, Any import torch import torch.nn.functional as F from allennlp.data import Vocabulary from allennlp.models.model import Model from allennlp.modules import FeedForward, TextFieldEmbedder, Seq2SeqEncoder from allennlp.nn import InitializerApplicator, RegularizerApplicator from al...
StarcoderdataPython
80644
import json import os import time import urllib.parse import urllib.request import pandas as pd import pathlib #ルートディレクトリの設定(dataディレクトリ ) root_dir = pathlib.Path(__file__).parent.parent #都道府県一覧の取得 c = os.path.join(root_dir, 'codes/preflist.json') with open(c) as j: prefList = json.load(j) #市区町村一覧の取得 c = os.path....
StarcoderdataPython
123845
import requests import os import json import pandas as pd os.chdir("D:\\SynologyDrive\Programming\AlpacaTradingBot") endpoint = "https://paper-api.alpaca.markets" headers = json.loads(open("key.txt", 'r').read()) # https://alpaca.markets/docs/api-documentation/api-v2/orders/ def market_order(symbol, q...
StarcoderdataPython
3218919
# Generated by Django 3.2.7 on 2021-10-08 02:06 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('cryptkeeper', '0002_auto...
StarcoderdataPython
32581
<gh_stars>0 import numpy as np from collections import deque QLEN = 8 class Line(object): """ from #2.Tips and Tricks for the Project """ def __init__(self, yp=None, xp=None): self.ym_per_pix = yp self.xm_per_pix = xp # self.frame_shape = fs # was the line detected in the la...
StarcoderdataPython
3336061
import pytest from distributed.protocol import serialize, deserialize import pandas as pd import numpy as np @pytest.mark.parametrize("collection", [tuple, dict, list]) @pytest.mark.parametrize( "y,y_serializer", [ (np.arange(50), "dask"), (pd.DataFrame({"C": ["a", "b", None], "D": [2.5, 3.5, ...
StarcoderdataPython
3381642
from django.apps import AppConfig default_app_config = 'leonardo_hijack.Config' LEONARDO_ORDERING = -500 LEONARDO_APPS = [ 'leonardo_hijack', "hijack", "hijack_admin", "compat" ] # LEONARDO_MIDDLEWARES = [ # 'django.contrib.auth.middleware.AuthenticationMiddleware', # 'hijack.middleware.H...
StarcoderdataPython
3265870
<gh_stars>0 import os import sys from math import exp from PIL import Image sys.path.append("../ocrd_typegroups_classifier") from ocrd_typegroups_classifier.typegroups_classifier import TypegroupsClassifier if len(sys.argv)!=2: print('Syntax: python3 %s input-textline.jpg' % sys.argv[0]) img = Image.open(input(...
StarcoderdataPython
26046
#!/usr/bin/env python # encoding: utf-8 # The MIT License # # Copyright (c) 2011 Wyss Institute at Harvard University # # 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, i...
StarcoderdataPython
4800433
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 OpenStack LLC. # 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/...
StarcoderdataPython
91389
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This software is licensed as described in the file LICENSE, which # you should have received as part of this distribution. import unittest2 as unittest import mock import os class CompressTest(unittest.TestCase): def test_compress_js(self): from couchapp....
StarcoderdataPython
1720358
from base import Base from sqlalchemy import Column, Integer, String, Boolean from sqlalchemy.orm import relationship class Run(Base): __tablename__ = 'run' id = Column(Integer, primary_key=True) # One-to-Many relationship to Samples contained in Run samples = relationship("Sample", cascade="delete") # sequence...
StarcoderdataPython
1685926
""" Diagnostic Maps. Diagnostic to produce images of a map with coastlines from a cube. These plost show latitude vs longitude and the cube value is used as the colour scale. Note that this diagnostic assumes that the preprocessors do the bulk of the hard work, and that the cube received by this diagnostic (via the s...
StarcoderdataPython
1734744
<gh_stars>10-100 from __future__ import absolute_import import sys try: __PKG_SETUP__ except NameError: __PKG_SETUP__ = False if __PKG_SETUP__: sys.stderr.write('Running from source directory.\n') else: from . import alg from . import bench from . import distutils from . import plotter __all__ = [] __all__....
StarcoderdataPython
193354
#!/usr/bin/env python3 import time from matrix_client.client import MatrixClient from matrix_client.api import MatrixRequestError from requests.exceptions import ConnectionError, Timeout import argparse import random from configparser import ConfigParser import re import traceback import urllib.parse import logging imp...
StarcoderdataPython
1677554
<filename>InvenTree/barcodes/plugins/inventree_barcode.py<gh_stars>1-10 """ The InvenTreeBarcodePlugin validates barcodes generated by InvenTree itself. It can be used as a template for developing third-party barcode plugins. The data format is very simple, and maps directly to database objects, via the "id" parameter...
StarcoderdataPython
1764569
import glob import re import os import datetime import argparse as ap import matplotlib # Enables saving plots over ssh try: os.environ['DISPLAY'] except KeyError: matplotlib.use('Agg') import matplotlib.pyplot as plt from operator import itemgetter, attrgetter, methodcaller import numpy as np def main(): ...
StarcoderdataPython
83164
<reponame>haikezegwaard/msg_parser # coding=utf-8 # autogenerated using ms_props_generator.py DATA_TYPE_MAP = { "0x0000": "PtypUnspecified", "0x0001": "PtypNull", "0x0002": "PtypInteger16", "0x0003": "PtypInteger32", "0x0004": "PtypFloating32", "0x0005": "PtypFloating64", "0x0006": "PtypCur...
StarcoderdataPython
1711192
# pyright: reportUndefinedVariable=false from sly import Lexer from ..exceptions import SyntaxError class ExpressionLexer(Lexer): # Set of token names. tokens = { VALUE, INT, FLOAT, BETWEEN, AND, OR, NOT, IN, EQ, NE, GT, ...
StarcoderdataPython
1652440
# Copyright 2015, 2016 OpenMarket Ltd # Copyright 2017 New Vector Ltd # # 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...
StarcoderdataPython
1707192
import sys import os UTILS_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'utils') sys.path.insert(1, UTILS_DIR) from training import train, test if __name__ == '__main__': """ This assumes a pretrained actor at the actor-path. """ BREAK_EARLY = False BATCH_SIZE = 500 ...
StarcoderdataPython
1714463
#!/usr/bin/python ''' Given a running machine with ssh, apply a configuration ''' import logging import os import sys from bellatrix.lib import bellatrix_util from bellatrix.lib import util import bellatrix.bewitch_ami class Provision(bellatrix.bewitch_ami.Bewitch): def __init__(self, key, sec, app_name, pk, ...
StarcoderdataPython
3201839
from ._NumExpr import NumExpr from ._Basic import AlwaysTrue, AlwaysFalse, And, Not, Or
StarcoderdataPython
123120
def change(img2_head_mask, img2, cv2, convexhull2, result): (x, y, w, h) = cv2.boundingRect(convexhull2) center_face2 = (int((x + x + w) / 2), int((y + y + h) / 2)) #can change it to Mix_clone seamlessclone = cv2.seamlessClone(result, img2, img2_head_mask, center_face2, cv2.NORMAL_CLONE) re...
StarcoderdataPython
167709
<reponame>csc-training/geocomputing<filename>pouta/arcpy/test_data/my_arcpy_script.py import arcpy from arcpy.sa import * import os arcpy.env.overwriteOutput = True directory = "./output/" if not os.path.exists(directory): os.makedirs(directory) outFlowDirection = FlowDirection("./dem.tif", "NORMAL") outFlowDir...
StarcoderdataPython
1744661
<reponame>CEHENKLE/opensearch-py<filename>test_opensearchpy/test_server/conftest.py # SPDX-License-Identifier: Apache-2.0 # # The OpenSearch Contributors require contributions made to # this file be licensed under the Apache-2.0 license or a # compatible open source license. # # Modifications Copyright OpenSearch Contr...
StarcoderdataPython
3385895
def to_hex(val): '''Return val as str of hex values concatenated by colons.''' if type(val) is int: return hex(val) try: # Python-2.x if type(val) is long: return hex(val) except NameError: pass # else: try: # Python-2.x return ":".join...
StarcoderdataPython
3292196
import sys from typing import NoReturn, Optional import click def default(message: str, exit_with_code: Optional[int] = None) -> None: click.echo(message) if exit_with_code: sys.exit(exit_with_code) def success(message: str) -> None: click.secho(message, fg="green") def error(message: str, ex...
StarcoderdataPython
1674872
<gh_stars>1-10 from __future__ import print_function from math import pi from bokeh.client import push_session from bokeh.document import Document from bokeh.models.glyphs import Line, HBar from bokeh.models import (Plot, ColumnDataSource, DataRange1d, FactorRange, LinearAxis, CategoricalAxi...
StarcoderdataPython
3309226
""" Installs the vanilla distribution of kubeflow and validates FSx for Lustre integration by: - Installing the FSx CSI Driver from upstream - Creating the required IAM Policy, Role and Service Account - Creating the FSx for Lustre Volume - Creating a StorageClass, PersistentVolume and PersistentVolume...
StarcoderdataPython
72183
<reponame>nthparty/rbcl """Allow users to use classes directly.""" from rbcl.rbcl import\ crypto_scalarmult_ristretto255,\ crypto_scalarmult_ristretto255_BYTES,\ crypto_scalarmult_ristretto255_SCALARBYTES,\ crypto_scalarmult_ristretto255_base,\ crypto_core_ristretto255_BYTES,\ crypto_core_ristre...
StarcoderdataPython
182693
"""This package contains infrastructure for solving differential equations within ``simframe``. The ``Integrator`` class is the basic class that advances the simulation from snapshot to snapshot by executing one integration ``Instruction`` at a time. Instructions contain a list of integration ``Scheme``. The ``schemes`...
StarcoderdataPython
3390222
import sys sys.setdefaultencoding('utf8')
StarcoderdataPython
1766777
"""Various kernels""" import abc import numpy as np from scipy import signal from fsic import util class Kernel(metaclass=abc.ABCMeta): """Abstract class for kernels""" @abc.abstractmethod def eval(self, X1, X2): """Evalute the kernel on data X1 and X2 """ class KHoPoly(Kernel): """Homog...
StarcoderdataPython
1671104
# Generated by Django 2.2.19 on 2021-05-27 20:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tax_calendar', '0001_initial'), ] operations = [ migrations.AddField( model_name='regulator', name='slug', ...
StarcoderdataPython
4827002
<gh_stars>10-100 """ Random generation of approval profiles """ import random from math import fabs, sqrt from abcvoting.preferences import Profile def random_profile(num_voters, num_cand, prob_distribution, committeesize=None, **kwargs): if prob_distribution == "IC": return random_IC_profile(num_cand, ...
StarcoderdataPython
1755359
<reponame>iashraful/survey-api """slug-added Revision ID: e4367957251b Revises: <PASSWORD> Create Date: 2021-09-18 07:59:48.356988 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '<PASSWORD>' branch_labels = None depends_on = None def ...
StarcoderdataPython
95773
<reponame>megado123/azure-cosmosdb-python-function-app import json import os import uuid import docdb import platform print("Python == ", platform.python_version()) os.environ["DOCDB_HOST"] = 'https://cs489cosmossql.documents.azure.com:443/' os.environ["DOCDB_KEY"] = '<KEY> # request body (POST requests) is stored ...
StarcoderdataPython
178331
<gh_stars>0 from enum import Enum class Side(Enum): """ Brain hemisphere side. """ LEFT = 'left' RIGHT = 'right'
StarcoderdataPython
3287527
# ************************************************************ # Copyright (c) 2020, <NAME> - All Rights Reserved. # You may use, distribute and modify this code under the # terms of the BSD-3 license. You should have received a copy # of the BSD-3 license with this file. # If not, visit: https://opensource.org/license...
StarcoderdataPython
1618374
class Solution: def minDistance(self, word1: str, word2: str) -> int: m = len(word1) n = len(word2) mat = [[0] * (n + 1) for _ in range(m + 1)] for i in range(m + 1): mat[i][0] = i for j in range(n + 1): mat[0][j] = j print(mat) for i ...
StarcoderdataPython
42750
<filename>awsrun/student/tasks.py import os import time from abc import ABC, abstractmethod, ABCMeta from common.commands import Compress, Upload, SendMsg, Download, Decompress from common.configuration import AWSConfig from common.protocol import IOTask, AWSMsg, AWSIDRegistration from common.resources import Folder, ...
StarcoderdataPython
3326452
<gh_stars>10-100 import falcon from .hello import HelloName from .root import Root def get_routes(app: falcon.App): app.add_route("/", Root()) app.add_route("/hello/{name}", HelloName())
StarcoderdataPython
152409
<filename>conftest.py import pytest import requests import shutil from pathlib import Path from typing import Generator from readimc import MCDFile, TXTFile _imc_test_data_asset_url = ( "https://github.com/BodenmillerGroup/TestData" "/releases/download/v1.0.7/210308_ImcTestData_raw.tar.gz" ) _imc_test_data_...
StarcoderdataPython
166824
import os import sys from plistlib import Plist from . import __version__ as bdist_mpkg_version from . import tools from .py3k import unicode, u, any_str_type def _major_minor(v): rval = [0, 0] try: for i, rev in enumerate(v.version): rval[i] = int(rev) except (TypeError, ValueError, I...
StarcoderdataPython
157249
# Copyright (C) 2015 by <NAME> <<EMAIL>> # # muniments is freely distributable under the terms of an MIT-style license. # See COPYING or http://www.opensource.org/licenses/mit-license.php. from test_muniments.test_fixtures import register_fixture from test_muniments.test_integration.test_external.test_couchdb import C...
StarcoderdataPython
4839375
<gh_stars>1-10 # -*- coding:UTF-8 -*- # Author:<NAME> # Date: Fri, 26 Feb 2021, 00:55 # Project Euler # 060 Prime pair sets #==================================================================Solution import os, sys BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) sys.path.append(BASE_DIR...
StarcoderdataPython
1640605
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under ...
StarcoderdataPython
194385
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: broker/dev/service_class.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import ref...
StarcoderdataPython
73375
<gh_stars>0 import pytest from graphapi.tests.utils import populate_db from openstates.data.models import Organization, Person, Membership from utils.common import pretty_url @pytest.mark.django_db def setup(): populate_db() house = Organization.objects.get( classification="lower", jurisdiction__name=...
StarcoderdataPython
176996
# flake8: noqa from .about import __version__ from .candidate import Candidate from .ice import Connection
StarcoderdataPython
123240
<reponame>frenzylabs/ancilla ''' node.py ancilla Created by <NAME> (<EMAIL>) on 01/08/20 Copyright 2019 FrenzyLabs, LLC. ''' from .base import Event, State class NodeEvent(Event): key = "node" events = dict( services = "created", updated = "updated", deleted = "deleted", state = State )
StarcoderdataPython
1730965
<reponame>avmi/plato-research-dialogue-system<filename>plato/agent/component/dialogue_policy/reinforcement_learning/reward_function.py """ Copyright (c) 2019-2020 Uber Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You...
StarcoderdataPython
60688
#! /usr/bin/env python3 # -*- coding: utf-8 -*- import os, json def main(): fp = 'vocab.json' with open(fp, 'r') as f: caption_token_to_idx = json.load(f)['question_token_to_idx'] caption_tokens = list(caption_token_to_idx.keys()) print(caption_tokens[5:]) with open("clevr-scene-nouns.t...
StarcoderdataPython
3242460
# coding: utf-8 # In[1]: s = [15,17,13,20,19,17,25,10,18,40,21,35,11,25,30,29,35,34,25,18,27,45,36,22,28,38,46,47,24,11,14,16,27,61,52,33,35,48,16,27,26,48,51,50,60,62,54,58,25,27,35,42,47,45,55,38,70,61,47,44,34,36,35,61,65,70,53,54,54,56,47,11,21,22,24,53,52,53,70,62,61,21,18,11,21,18,27,24,25,26,22,12,11,22,23,3...
StarcoderdataPython
3202568
<reponame>theomarzaki/TrafficOrchestrator # This script provides a way for the TO to predict the neighrest cars to the merging car to # provide a state space for the lane merge enviroment. Uses an LSTM Model to acheive this: # Sequential learning -> change to minibatch learning # multi variable classifir -> sequence ...
StarcoderdataPython
4822101
""" @ Filename: Cluster.py @ Author: <NAME> @ Create Date: 2019-05-15 @ Update Date: 2019-05-20 @ Description: Implement Cluster """ import sys import numpy as np import preProcess import pickle import random import matplotlib.pyplot as plt class KMeans: def __init__(self, norm_type="Normali...
StarcoderdataPython
3559
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_orthoexon ---------------------------------- Tests for `orthoexon` module. """ import os import pytest @pytest.fixture def exon_id_with_quotes(): return "'ENSE00001229068.1'" @pytest.fixture def exon_id(): return "ENSE00001229068.1" def test_separate_...
StarcoderdataPython
1672519
# -*- coding: utf-8 -*- import re from collections import defaultdict from .utils import u, get, dump try: import click except ImportError: print('Install this package with the [cli] extras to enable the CLI.') raise @click.group() def cli(): pass @cli.command() def update(): """ Update th...
StarcoderdataPython
3203581
""" launcher program for the music player """ import music_player.music_player as mp from RPi import GPIO def main(): try: music_player = mp.Music_player() music_player.start() except KeyboardInterrupt: GPIO.cleanup() if __name__ == "__main__": main()
StarcoderdataPython
87580
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import json import warnings import pulumi import pulumi.runtime from . import utilities, tables class GetCallerIdentityResult: """...
StarcoderdataPython
3224339
<gh_stars>1000+ import argparse import pandas as pd if __name__ == '__main__': parser = argparse.ArgumentParser( description="Check for missing colors & locations", formatter_class=argparse.ArgumentDefaultsHelpFormatter ) parser.add_argument('--metadata', type=str, nargs='+', required=True...
StarcoderdataPython
3213182
<reponame>izilly/izdvd<gh_stars>0 # -*- coding: utf-8 -*- # # Copyright (c) 2013 <NAME> # Distributed under the terms of the Modified BSD License. # The full license is in the file LICENSE, distributed with this software. PROG_NAME = 'izdvd' PROG_URL = 'https://github.com/izzilly/izdvd' VIDEO_PLAYER = 'mplayer' IM...
StarcoderdataPython
3389549
"""Proof of concept for a federated digital data exchange.""" __version__ = '0.1.0-dev'
StarcoderdataPython
4842088
<filename>PythonTKinter/LayoutPackSide.py from tkinter import * janela = Tk() lb1 = Label(janela,text='RIGHT',bg='white') lb2 = Label(janela,text='BOTTOM',bg='white') lb3 = Label(janela,text='LEFT',bg='white') lb4 = Label(janela,text='TOP',bg='white') lb1.pack(side=RIGHT) lb2.pack(side=BOTTOM) lb3.pack(side=LEFT) lb...
StarcoderdataPython
4832837
# Copyright 2018 The TensorFlow 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 applica...
StarcoderdataPython
3202967
<gh_stars>0 import copy import warnings from mmcls.core import support, precision_recall_f1 from mmcls.datasets import BaseDataset, DATASETS import numpy as np import pyarrow as pa from mmcls.models import accuracy import csv @DATASETS.register_module() class GoogleLandmarkDataset(BaseDataset): def __init__(sel...
StarcoderdataPython
3262264
import sys import random from test_base import * class TestStride2(TestBase): def generate(self): self.clear_tag() for x in range(1,13): stride = (2**x)-1 taddr = 0 while taddr < self.MAX_ADDR: self.send_sb(taddr) taddr += stride taddr = 0 ...
StarcoderdataPython
48836
<gh_stars>1-10 from lixian_commands.util import * from lixian_cli_parser import * from lixian_encoding import default_encoding import lixian_help import lixian_query @command_line_parser(help=lixian_help.readd) @with_parser(parse_login) @with_parser(parse_logging) @command_line_option('deleted') @command_line_option(...
StarcoderdataPython
1646572
from flask import Flask, request import tensorflow as tf from correct_text import create_model, DefaultMovieDialogConfig, decode from text_corrector_data_readers import MovieDialogReader data_path = '/input/data/movie_dialog_train.txt' model_path = '/input/model' tfs = tf.Session() config = DefaultMovieDialogConfig(...
StarcoderdataPython
3270183
''' This module will draw the national flag in inscape ''' from pyautogui import * from time import sleep def draw_rectangle(): press('s') click(568,300) location =[[775,-168,167,-775,568,534,"ff6600ff"],[775,-171,171,-775,568,705,"ffffff"],[775,-169,169,-775,568,300,"449900ff"]] click(568,367,du...
StarcoderdataPython
1702986
from math import sin, cos, pi,tan, atan2,log import math from itertools import groupby from operator import itemgetter import tf import rospy import numpy as np from geometry_msgs.msg import TransformStamped from geometry_msgs.msg import PointStamped class distance_obj: def __init__(self,dis) s...
StarcoderdataPython
1736369
<reponame>hugmyndakassi/Facedancer # MAXUSBApp.py # # Contains class definition for MAXUSBApp. import time from ..core import FacedancerApp from ..USB import * from ..USBDevice import USBDeviceRequest class MAXUSBApp(FacedancerApp): reg_ep0_fifo = 0x00 reg_ep1_out_fifo = 0x0...
StarcoderdataPython
1626102
<gh_stars>0 # Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """FedCurv Aggregation function module.""" import numpy as np from .weighted_average import WeightedAverage class FedCurvWeightedAverage(WeightedAverage): """Aggregation function of FedCurv algorithm. Applies weigh...
StarcoderdataPython
146337
import unittest from itcc import ITCC import pandas as pd class TestITCC(unittest.TestCase): def test_itcc_ingest(self): i = ITCC() df = i.get_path_matrix() self.assertEqual(type(df), pd.DataFrame) print(df.describe()) print("=" * 80) def test_getCXY(self): i =...
StarcoderdataPython