id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
1653533
<filename>analyze/match.py import sys import matplotlib.pyplot as plt import cv2 as cv import numpy as np fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(9.3, 6), sharex=True, sharey=True) fig.subplots_adjust(left=0.03, right=0.97, hspace=0.3, wspace=0.05) ax = axes.ravel() for a in ax.ravel(): a.axis('of...
StarcoderdataPython
3220496
<gh_stars>0 #!/usr/bin/env python3 # coding: utf-8 import argparse import os.path from torch.autograd import Variable import torch.onnx import sys import os import os.path as osp sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__)))) from models.resnet50_unet_activation import UNetWithResnet50Encoder from ...
StarcoderdataPython
1647124
<filename>posda/posdatools/python/posda/main/__init__.py import sys import json import os import subprocess from ..util import md5sum from ..util import printe from .file import insert_file def get_parameters(): test = sys.stdin.read() return json.loads(test) def get_stdin_input(): lines = [] for ro...
StarcoderdataPython
9617112
<filename>interfearence_hardware/src/interfearence_hardware/odrive_interface.py import odrive from odrive.enums import * from odrive.utils import dump_errors import time class OdriveInterface: def __init__(self): # CONSTANTS self.MIN_MOTOR_RADS = 104 # So min wheel speed is ~50 RPM self.MA...
StarcoderdataPython
1829857
<reponame>zmaktouf/restsim from flask import Flask, request, make_response, jsonify from functools import wraps import os import json app = Flask(__name__) g_data_cache={} g_data_args_cache={} DATA_CACHE = 1 ARGS_CACHE = 2 def _get_data(path, cachetype=DATA_CACHE): global g_data_cache global g_data_args_cac...
StarcoderdataPython
9786126
"""Some useful tools.""" from ..errors import AsinNotFoundException import re def get_asin(text: str) -> str: """Returns the ASIN from a given text. Raises AsinNotFoundException on fail.""" # Return if text is an ASIN if re.search(r'^[A-Z0-9]{10}$', text): return text # Extract ASIN from URL...
StarcoderdataPython
8004458
def clean_groups(): groups = [] f = open('day6.txt','r') data =f.readlines() group = '' for d in data: d = d[0:len(d)-1] group += ' ' + d if d == '': groups.append(group) group = '' return groups def count_uinique_answers_part1(groups): ...
StarcoderdataPython
11237894
<filename>tests/tests/models/test_file.py import os from app.models import FileExample from paper_uploads.models import UploadedFile from ..dummy import * from .test_dummy import ( TestFileFieldResource, TestFileFieldResourceAttach, TestFileFieldResourceDelete, TestFileFieldResourceEmpty, TestFile...
StarcoderdataPython
5114481
import base64 import random import string import requests class SimasterQrPresence: BASIC_AUTH_KEY = 'integrasiPresensiQR:serv1CEintegrasi-Pre$en$iGHQR' SIMASTER_URL = 'https://simaster.ugm.ac.id' LOGIN_URL = f'{SIMASTER_URL}/services/simaster/service_login' COMMIT_DEVICE_URL = f'{SIMASTER_URL}/servi...
StarcoderdataPython
1762986
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- import datetime from SSCClient.core import SSCClient from SSCClient.utils import func_extract_all_project_names from collections import defaultdict if __name__ == "__main__": ssc_client = SSCClient("https://192.168.1.1/ssc") # ssc_client.set_auth_toke...
StarcoderdataPython
4987581
import pandas import random import collections MALE = 0 FEMALE = 1 # This life table actually comes from # https://www.kitces.com/joint-life-expectancy-and-mortality-calculator/ # However, upon closer inspection, the numbers don't match up with the # numbers from the 2004 Period Life Table, so I'm not sure what the s...
StarcoderdataPython
6644383
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'dockWindowa.ui' # # Created by: PyQt5 UI code generator 5.15.2 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 impor...
StarcoderdataPython
3334356
from __future__ import absolute_import class TokenType(object): def __init__(self, name, contains_syntax=False): self.name = name self.contains_syntax = contains_syntax def __repr__(self): return '%s(%s)' % (self.__class__.__name__, self.name) class TokenTypes(object): """ B...
StarcoderdataPython
28382
<reponame>sadpotatoes/G6capstone-AI_Education<filename>app/ImagePreprocessing.py # -*- coding: utf-8 -*- """ Created on Sat Feb 8 11:20:09 2020 @author: Donovan """ class ImagePreprocessing: """@package ImagePreprocessing This class extracts a number of features from the images and saves them in a CSV ...
StarcoderdataPython
3301215
<filename>hatsploit/modules/exploit/linux/dlink/hedwig_code_execution.py #!/usr/bin/env python3 # # This module requires HatSploit: https://hatsploit.netlify.app # Current source: https://github.com/EntySec/HatSploit # import struct from hatsploit.lib.module import Module from hatsploit.utils.handler import Handler ...
StarcoderdataPython
3325633
import comics_net.analyzer as analyzer metadata_path = "./comics_net/resources/metadata.jsonl" labels_path = "./comics_net/resources/fantastic_four/labels.txt" def test_load_metadata(): metadata = analyzer.load_metadata(metadata_path) expected_keys = set( [ "cover_characters", ...
StarcoderdataPython
3444589
import esphome.codegen as cg import esphome.config_validation as cv from esphome import pins from esphome.const import ( CONF_FREQUENCY, CONF_ID, CONF_INPUT, CONF_OUTPUT, CONF_SCAN, CONF_SCL, CONF_SDA, CONF_ADDRESS, CONF_I2C_ID, ) from esphome.core import coroutine_with_priority, COR...
StarcoderdataPython
1620668
import json import pytest from sovtoken import TokenTransactions, TOKEN_LEDGER_ID from sovtoken.request_handlers.write_request_handler.xfer_handler import XferHandler from sovtoken.request_handlers.write_request_handler.xfer_handler_1_0_0 import XferHandler100 from sovtoken.sovtoken_auth_map import sovtoken_auth_map f...
StarcoderdataPython
5072085
<reponame>douglasdavis/root_numpy<gh_stars>10-100 import numpy as np import ROOT from ROOT import TMVA from . import _libtmvanumpy from .. import ROOT_VERSION __all__ = [ 'add_classification_events', 'add_regression_events', ] NEW_TMVA_API = ROOT_VERSION >= '6.07/04' def add_classification_events(obj, even...
StarcoderdataPython
327840
import gzip import os import subprocess as sp import tempfile import uuid from unittest import mock, TestCase from unittest.mock import call import anndata import kb_python.utils as utils from kb_python.config import CHUNK_SIZE, UnsupportedOSException from tests.mixins import TestMixin def dry_dummy_function(i): ...
StarcoderdataPython
4980415
<gh_stars>0 # Importing native django packages: from django.shortcuts import render, redirect from django.contrib.auth.decorators import user_passes_test from django.contrib.staticfiles.storage import staticfiles_storage from django.templatetags.static import static from django.conf import settings from django.db.model...
StarcoderdataPython
1702848
<reponame>m-payal/AlgorithmsAndDataStructure """ Title - Gnome Sort Algorithm Pupose - Sorts a given array in ascending order. Time Complexity - O(n^2) """ import random class GnomeSort: """ GnomeSort Algorithm Implementation arr: an unordered list output: return list in ascending order ...
StarcoderdataPython
9779349
#!/usr/bin/env python import json import os from aws_cdk import core from deploy.deploy_stack import DeployStack # generated from local-deploy.sh cfg = "deploy.json" stackname = None if os.path.exists(cfg): with open(cfg) as deploy_cfg: stackname = json.load(deploy_cfg)["stackname"] # use user generated...
StarcoderdataPython
1788884
<reponame>CarterWS/Summer2020<gh_stars>0 # https://github.com/micropython/micropython/blob/master/docs/pyboard/tutorial/timer.rst import pyb tim = pyb.Timer(4) tim.init(freq=10) tim.callback(lambda t:pyb.LED(1).toggle()) pyb.delay(2000) tim.callback(None) tim4 = pyb.Timer(4, freq=10) tim7 = pyb.Timer(7, freq=20...
StarcoderdataPython
255291
<reponame>ungood/graupel-1<filename>processing/overlays.py import cv2 import numpy as np from collections import namedtuple from matplotlib import pyplot as plt from typing import Callable Layout = namedtuple('Layout', ['x', 'y', 'width', 'height']) class Overlay: def __new__(cls, layout: Layout): new = object...
StarcoderdataPython
5070868
<filename>preprocessing/image_preprocessing/generate_img_lists.py<gh_stars>10-100 # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import print_function import argparse import os import pandas as pd from sklearn.model_selection import train_test_split import logging logging.basicConfig(le...
StarcoderdataPython
1879140
#!/usr/bin/python # -*- coding: utf-8 -*- from collections import OrderedDict import re import sys reload(sys) sys.setdefaultencoding("utf-8") f = open("preprocess/iso9", 'rb') lines = [line for line in f] bigru = lines[::4] smallru = lines[1::4] bigen = lines[2::4] smallen = lines[3::4] iso = OrderedDict() for br, s...
StarcoderdataPython
1752019
<reponame>Toskgreg/GoldenLions<filename>tests/test_base.py import json from api import app, test_client class TestBase(): """ Class containing common test procedures """ def create_user_data(self, **kwags): return { 'user_name': kwags.get('user_name', 'bison'), 'email':...
StarcoderdataPython
12851781
# -*- coding: utf-8 -*- # Copyright (C) 2017-2019 by # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # BSD license. # # Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> """Assorted degree related graph utilities. """ import collections from grinpy import degree, nodes, number_of_nodes from grinpy.functions.nei...
StarcoderdataPython
6607764
<reponame>timotheuslin/pyedid<filename>pyedid/main.py """ Entrypoint """ import sys from pyedid.edid import Edid from pyedid.helpers.edid_helper import EdidHelper from pyedid.helpers.registry import Registry def main(): """Main func""" xrandr_file = '' if len(sys.argv) == 1 else sys.argv[1] if xrandr_fi...
StarcoderdataPython
3489111
from core.actions.base import Action from core.actions.baseresolution import ActionResolution class ActionStack(object): """ An action stack keeping track of the action resolutions of a game object. """ __slots__ = ["game", "game_object", "action_resolutions", "update_turn_callback"] def __init__...
StarcoderdataPython
262873
# zmq push example. Run the zmq_puller.py program for the client import curio_zmq as zmq async def pusher(address): ctx = zmq.Context() sock = ctx.socket(zmq.PUSH) sock.bind(address) for n in range(100): await sock.send(b'Message %d' % n) await sock.send(b'exit') if __name__ == '__main__'...
StarcoderdataPython
4945400
<reponame>vtashev/local_luftdaten """ Support for Luftdaten sensors. Copyright (c) 2019 <NAME> Licensed under MIT. All rights reserved. https://github.com/lichtteil/local_luftdaten/ """ import logging import asyncio import json from datetime import timedelta import requests import voluptuous as vol from homeassi...
StarcoderdataPython
11376611
from pycat.base.event import KeyCode, KeyEvent, MouseEvent from pycat.sound import AudioLoop, Player from pycat.core import Sprite, Window window = Window(title="Sound Test") class MusicalSprite1(Sprite): def setup(self, x: float, sound: Player): self.position = (x, 0.33 * window.height) self.sou...
StarcoderdataPython
11370339
# coding=utf-8 """ @Time : 2020/12/26 13:04 @Author : <NAME> (github.com/VincentGaoHJ) @Email : <EMAIL> <EMAIL> @Sketch : """ from src.graphviz.textrank import textrank from src.graphviz.postprune import postPrune from src.graphviz.generate import generatetxt from src.graphviz.preprocess import graphv_prep from ...
StarcoderdataPython
1603805
<filename>example/build_config.py<gh_stars>0 # Copyright (c) 2020 Nutanix Inc. All rights reserved. # # Author: <EMAIL> import os import json from foundation_node import FoundationNode config_dict = {} def get_node_config(): fp = open('node_config.json', "r") node_config = fp.read() fp.close() node_config = j...
StarcoderdataPython
9640778
<reponame>cdagnino/ngboost from .normal import Normal, NormalFixedVar #from .laplace import Laplace, LaplaceFixedVar from .lognormal import LogNormal #from .loglaplace import LogLaplace from .exponential import Exponential from .bernoulli import Bernoulli
StarcoderdataPython
3597304
<filename>dippy/core/models/reaction.py from dippy.core.models.emoji import EmojiModel from dippy.core.models.model import DippyCoreModel class ReactionModel(DippyCoreModel): count: int me: bool emoji: EmojiModel
StarcoderdataPython
245
<filename>gen-cfg.py from staticfg import CFGBuilder userCfg = CFGBuilder().build_from_file('user.py', './auction/user.py') bidCfg = CFGBuilder().build_from_file('bid.py', './auction/bid.py') auctionCfg = CFGBuilder().build_from_file('auction.py','./auction/auction.py') #auctionEventCfg = CFGBuilder().build_from_file...
StarcoderdataPython
8170617
<reponame>haohanchen-yagao/deep-learning-containers import pytest import test.test_utils.ecs as ecs_utils import test.test_utils.ec2 as ec2_utils from test.test_utils import request_pytorch_inference_densenet, get_framework_and_version_from_tag, get_inference_server_type from test.test_utils import ECS_AML2_CPU_USWEST...
StarcoderdataPython
5147526
<filename>predict_model.py import os import pickle import numpy as np import pandas as pd from lightgbm.sklearn import LGBMRegressor, LGBMClassifier import django from django.conf import settings os.environ.setdefault("DJANGO_SETTINGS_MODULE", "raspberry.settings") django.setup() from monitor.models import PlantEnvir...
StarcoderdataPython
11268867
<filename>okcupid/admin.py # Register your models here. from django.contrib import admin from okcupid.models import UserProfile, Gender, Question, Opinion, SentQuestion admin.site.register(UserProfile) admin.site.register(Gender) admin.site.register(Question) admin.site.register(Opinion) admin.site.register(SentQuest...
StarcoderdataPython
11364003
<filename>developer_tools/dymola_python_testing/ModelicaPy/buildingspy/tests/test_development_error_dictionary.py #Licensed under Apache 2.0 License. #© 2020 Battelle Energy Alliance, LLC #ALL RIGHTS RESERVED #. #Prepared by Battelle Energy Alliance, LLC #Under Contract No. DE-AC07-05ID14517 #With the U. S. Department ...
StarcoderdataPython
81895
<filename>actinia_metadata_plugin/model/responseModels.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2018-2021 mundialis GmbH & Co. KG 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 Licen...
StarcoderdataPython
11356865
from output.models.nist_data.list_pkg.g_month_day.schema_instance.nistschema_sv_iv_list_g_month_day_pattern_3_xsd.nistschema_sv_iv_list_g_month_day_pattern_3 import NistschemaSvIvListGMonthDayPattern3 __all__ = [ "NistschemaSvIvListGMonthDayPattern3", ]
StarcoderdataPython
11320372
<reponame>nasa-gibs/gibs-validation-slackbot # Copyright 2018 California Institute of Technology. # # 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/LICEN...
StarcoderdataPython
3279116
import json import requests img_path = 'train/image/' mask_path = 'train/label/' with open('export.json', 'r') as js: dataset = json.load(js) for count, data in enumerate(dataset): if data['Label'] != 'Skip': img_url = data['Labeled Data'] mask_url = data['Label']['segmentationMas...
StarcoderdataPython
3273429
from torch.utils.data import Dataset, DataLoader from diffgram.core.diffgram_dataset_iterator import DiffgramDatasetIterator try: import torch as torch # type: ignore except ModuleNotFoundError: raise ModuleNotFoundError( "'torch' module should be installed to convert the Dataset into torch (pytorch) ...
StarcoderdataPython
3269838
from molsysmt._private_tools.exceptions import * from molsysmt.forms.common_gets import * from molsysmt import puw from molsysmt.native.molecular_system import molecular_system_components import numpy as np form_name='biopython.Seq' is_form={ 'Bio.Seq.Seq' : form_name } info=["",""] has = molecular_system_compo...
StarcoderdataPython
9788496
<filename>Fuzzy_clustering/version3/DatasetManager/create_datasets_PCA.py import numpy as np import pandas as pd import joblib, os, logging from joblib import Parallel, delayed from scipy.interpolate import interp2d from sklearn.decomposition import KernelPCA from sklearn.preprocessing import MinMaxScaler from sklearn....
StarcoderdataPython
1847391
<reponame>nathanielsimard/improving-fs-ssl import unittest from mcp.data.dataset.dataset import ( ComposedDataset, ListDataset, create_few_shot_datasets, ) from tests.helpers.dataset import ( create_random_dataset, item_equal, unique_classes, unique_samples, ) NUM_ITEMS = 100 NUM_CLASSES =...
StarcoderdataPython
5098809
from unittest import TestCase from src.validationlib.validation import greaterThenZero, greaterOrEqualThenZero, validInt, validFloat class TestValidationLib(TestCase): def test_greater_than_zero_return_false(self): assert greaterThenZero(0) == False def test_greater_than_zero_return_true(self): assert greaterT...
StarcoderdataPython
150272
""" Tests for seed_services_cli.identity_store """ from unittest import TestCase from click.testing import CliRunner from seed_services_cli.main import cli import responses import json class TestSendCommand(TestCase): def setUp(self): self.runner = CliRunner() def tearDown(self): pass d...
StarcoderdataPython
6517123
# -*- coding: utf-8 -*- import pandas as pd import geopandas as gpd import matplotlib.cm as cm import matplotlib.pyplot as plt import descartes import jellyfish from shapely import geometry from shapely.geometry import Point from shapely.geometry.polygon import Polygon def get_agricultural_moughataa(): file_...
StarcoderdataPython
3461257
<reponame>tinyos-io/tinyos-3.x-contrib def map_cc2420 (power): """ Map power levels for the cc2420 radio onto a gain. """ raise NotImplementedError def map_normalized_direct (power): """ Map power levels such that a value of X is (X - 127) dBm. Thus, the maximum level is 0 dBm (when power...
StarcoderdataPython
169180
from jeweler.bracelet import bracelet_fc def test_bracelet_fc(): help(bracelet_fc) result = bracelet_fc(6, 3, [1, 2, 3]) print(type(result)) for i in result: print(i) print() del result[2:] for i in result: print(i) if __name__ == "__main__": test_bracelet_fc()
StarcoderdataPython
1850326
<reponame>Abdulrahman-Kamel/exurl<gh_stars>1-10 from urllib.parse import urlsplit,parse_qs # Function take url and return params with this format => {'paramName': ['value'], 'age': ['33'], 'name': ['dekart']} def query(url): query = urlsplit(url).query params = parse_qs(query) return params # Function take query f...
StarcoderdataPython
8143590
import sys from setuptools import setup, find_packages from winrmcp import __version__, __description__, __author__, __author_email__, __url__ with open('README.md') as f: long_description = f.read() setup( name = 'winrmcp', version = __version__, description = __description__, author ...
StarcoderdataPython
3595493
import torch from collections import namedtuple from torchvision import models import torch.nn as nn import torch.nn.functional as F class TransformerNet(torch.nn.Module): def __init__(self): super(TransformerNet, self).__init__() self.model = nn.Sequential( ConvBlock(3, 32, kernel_size...
StarcoderdataPython
241699
<filename>src/cloud.py #! /usr/bin/env python # Copyright 2016 WebAssembly Community Group participants # # 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.or...
StarcoderdataPython
11257473
import asyncio import logging import signal from asyncio import FIRST_COMPLETED from collections import OrderedDict from io import BytesIO from pathlib import Path from typing import ( Set, MutableSequence, Mapping, Tuple, Sequence, MutableMapping, Optional, cast, Iterable, Async...
StarcoderdataPython
242953
<filename>hkust-gmission/gmission/rest/base.py<gh_stars>100-1000 from flask import request from gmission.blueprints.user import jwt_auth __author__ = 'chenzhao' import inspect class ReSTBase(object): @classmethod def universal_before_post(cls, data): # print 'Universal before_post' data.pop...
StarcoderdataPython
3232763
import csv import dwollav2 client = dwollav2.Client( key='REPLACE WITH CLIENT ID', secret='REPLACE WITH SECRET KEY', environment='sandbox' # Set to sandbox, change to production if needed ) customer_id = 'REPLACE WITH CUSTOMER ID' # Gets a token from the client object token = client.Auth.client() # Cre...
StarcoderdataPython
1618835
<reponame>ImJuanan/flask-milligram # -*- coding: utf-8 -*- import random from flask import Flask, render_template, request from flask_milligram import Milligram from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['SQLALCHEMY_DATABASE_URI'] = ...
StarcoderdataPython
3554779
######### from aliyunIoT import Device # iot组件是连接阿里云物联网平台的组件 import network # Wi-Fi功能所在库 import ujson ################## from driver import I2C,GPIO,TIMER import utime from ssd1306 import SSD1306_I2C import ir import time temptimerObj = 0 time_dict = {} ######### # 物联网平台连接标志位 iot_connected = Fa...
StarcoderdataPython
3282785
from appium.webdriver import webdriver from datetime import datetime from selenium.common.exceptions import WebDriverException """ To get to know how to use this project: https://github.com/AntoData/appium-framework/wiki """ class ScreenshotUtils: """ This class provides a key tool for this framework as it i...
StarcoderdataPython
8144215
from object_database.web.cells.cells import Cells from object_database.web.cells.cell import Cell, context from object_database.web.cells.main import Main from object_database.web.cells.root_cell import RootCell from object_database.web.cells.scrollable import Scrollable, VScrollable, HScrollable from object_database.w...
StarcoderdataPython
5049053
<reponame>VictorOnink/Particle-Trajectory-Analysis import socket import os # Checking which computer the code is running on HOSTNAME = 'Victors-MBP.home' if socket.gethostname() == HOSTNAME: SERVER = 'laptop' else: SERVER = 'remote_server' JOB_ID = int(os.environ["JOB_ID"]) # Setting directory paths mach...
StarcoderdataPython
9644286
from typing import List class Solution: def swap(self, s, pair_index: List): s_list = list(s) s_list[pair_index[0]], s_list[pair_index[1]] = s_list[pair_index[1]], s_list[pair_index[0]] return ''.join(s_list) def smallestStringWithSwaps(self, s: str, pairs: List[List[int]]) -> str: ...
StarcoderdataPython
1836416
<reponame>Ohara124c41/Nao-Robot import sys from naoqi import ALProxy def main(robotIP = "192.168.0.117", PORT=9559): try: postureProxy = ALProxy("ALRobotPosture", "192.168.0.117", 9559) except Exception, e: print "Could not create proxy to ALRobotPosture" print "Error was: ", e ...
StarcoderdataPython
11285059
<reponame>vutsalsinghal/python-terrascript # terrascript/grafana/__init__.py import terrascript class grafana(terrascript.Provider): pass
StarcoderdataPython
9753822
import pkgutil import custompack.custom as custom # See https://stackoverflow.com/questions/1707709/list-all-the-modules-that-are-part-of-a-python-package/1707786# package = custom for importer, modname, ispkg in pkgutil.iter_modules(package.__path__): print("Found submodule %s (is a package: %s)" % (modname, is...
StarcoderdataPython
279899
from numpy import * import matplotlib.pyplot as plt from scipy import interpolate import sys # x = loadtxt('cdf_r.dat') # y = arange(0, size(x),1)/float(size(x)) U_x = sort(loadtxt(sys.argv[1])[:,6]) for cnt in range(size(U_x)): if U_x[cnt] > 1.5: break; U_x = U_x[:cnt] U_t = [] for i in linspace(0,size...
StarcoderdataPython
222097
# -------------------- PATH --------------------- #ROOT_PATH = "/local/data2/pxu4/TypeClassification" ROOT_PATH = "." DATA_PATH = "%s/data" % ROOT_PATH ONTONOTES_DATA_PATH = "%s/OntoNotes" % DATA_PATH BBN_DATA_PATH="%s/BBN" % DATA_PATH LOG_DIR = "%s/log" % ROOT_PATH CHECKPOINT_DIR = "%s/checkpoint" % ROOT_PATH OUTPUT_...
StarcoderdataPython
6543128
import typing as t from dagos.core.components import SoftwareComponent from dagos.platform import OperatingSystem from dagos.platform import PlatformIssue from dagos.platform import PlatformSupportChecker class GitHubCliSoftwareComponent(SoftwareComponent): """ Manage the GitHub CLI. The GitHub CLI is u...
StarcoderdataPython
1963641
import os from time import time from binance.client import Client from binance.exceptions import BinanceAPIException from dotenv import load_dotenv load_dotenv() API_KEY = os.getenv("BINANCE_API_KEY") SECRET_KEY = os.getenv("BINANCE_SECRET_KEY") client = Client(API_KEY, SECRET_KEY) def generate_watchpa...
StarcoderdataPython
5190581
import warnings from django.db import models from django.contrib.postgres.fields import JSONField from django.utils.functional import cached_property class BasePBNModel(models.Model): created_on = models.DateTimeField(auto_now_add=True) last_updated_on = models.DateTimeField(auto_now=True) class Meta:...
StarcoderdataPython
1891790
<filename>Code.py<gh_stars>0 # Finished Program target=1 while 1: i=2 prime=True while i<target: if (target%i) == 0: prime=False break i=i+1 if (prime): print(target, "is a prime") target=target+1
StarcoderdataPython
1919944
""" curso Python 3 - Exercício Python #005 crie um programa que leia um numero inteiro e mostre na tela seu sucessor e antecessor 20.10.2020 - <NAME> """ n1 = int(input('Digite um numero inteiro ')) d = n1+1 a = n1-1 print('O numero inteiro digitado foi {}, seu sucessor é {} e antecessor é {}'.format(n1, d...
StarcoderdataPython
8176591
#$Id$# from books.util.ZohoHttpClient import ZohoHttpClient from books.parser.SettingsParser import SettingsParser from books.api.Api import Api from json import dumps base_url = Api().base_url + 'organizations/' zoho_http_client = ZohoHttpClient() parser = SettingsParser() class OrganizationsApi: """Organizatio...
StarcoderdataPython
3570980
<reponame>nielsvanhooy/genieparser """ show_hsrp_statistics.py IOSXR parsers for the following show commands: * show hsrp statistics * show hsrp {interface} statistics * show hsrp {interface} {group_number} statistics * show hsrp status """ # Python import re # Metaparser from genie.metaparser import...
StarcoderdataPython
1958059
import sys sys.setrecursionlimit(10000000) input=lambda : sys.stdin.readline().rstrip() n = int(input()) a = list(map(int,input().split())) if 1 not in a: print(-1) exit() max_len = 0 p = 1 for i in range(n): if a[i] == p: max_len += 1 p += 1 print(len(a) - max_len)
StarcoderdataPython
4984403
<reponame>marcovalenti/mmdetection import torch import torch.nn as nn import torch.nn.functional as F from mmcv.ops import sigmoid_focal_loss as _sigmoid_focal_loss from mmcv.ops import softmax_focal_loss as _softmax_focal_loss #for diseases from ..builder import LOSSES from .utils import weight_reduce_loss #DEBUG...
StarcoderdataPython
9647385
from grimp.domain.valueobjects import Module, DirectImport class TestModule: def test_repr(self): module = Module("foo.bar") assert repr(module) == "<Module: foo.bar>" def test_equals(self): a = Module("foo.bar") b = Module("foo.bar") c = Module("foo.bar.baz") ...
StarcoderdataPython
3406603
import struct class DaapNumericReader(object): """This class reads raw DAAP data and convert it to number """ @classmethod def uint8(cls, b): """Read 1 byte, then convert to an unsigned big-endian number """ n, = struct.unpack('>B', b) return n @classmethod de...
StarcoderdataPython
1852199
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """Fibonacci numbers test module.""" __author__ = "<NAME>" from pytest import mark, raises from fibonacci_gen import fibonacci_gen as fib_gen from fibonacci_rec import fibonacci_rec as fib_rec from even_fibonacci_gen import even_fibonacci_gen as efib_ge...
StarcoderdataPython
1807592
# TODO: Ensure that functions marked for inlining aren't recursive to # prevent infinite loops. from typing import Collection, List, Sequence, Set, Tuple from asts import lowered, visitor from scope import Scope calc_threshold = lambda value: value * 20 def expand_inline(tree: lowered.LoweredASTNode, level: int) -...
StarcoderdataPython
6444243
<filename>ProjetoGaloFinal.py # <NAME> 99108 def eh_posicao_marcada(pm): """ Pretende descobrir se o argumento inserido e ou nao uma posicao marcada. :param pm: Um int, posicao marcada. (-1 ou 1). :return: Um bool, veracidade do argumento. """ if type(pm) != int or pm != 1 and pm != -1: ...
StarcoderdataPython
3308120
<reponame>alffore/tileimagen """ Pruebas de comparacion de histogramas de imagenes https://www.pyimagesearch.com/2014/07/14/3-ways-compare-histograms-using-opencv-python/ https://docs.opencv.org/3.4/d8/dc8/tutorial_histogram_comparison.html """ import matplotlib.pyplot as plt import argparse import glob import cv2 #...
StarcoderdataPython
1621023
<gh_stars>0 import time import boto3 import json import common import os QUEUE = os.environ.get("QUEUE") client = boto3.client('sqs') url = client.get_queue_url(QueueName=QUEUE).get('QueueUrl') sqs = boto3.resource('sqs') queue = sqs.Queue(url) def getMessage(start): msg = queue.receive_messages() if msg: ...
StarcoderdataPython
385876
<reponame>sswarnakar/Behavioral-Cloning-Using-Udacity-Self-Driving-Car-Simulator import tensorflow as tf tf.python.control_flow_ops = tf from keras.models import Sequential, model_from_json, load_model from keras.optimizers import * from keras.layers import Dense, Activation, Flatten, Dropout, Lambda, Cropping2D, ELU ...
StarcoderdataPython
3421701
import pytest from pathlib import Path import datetime from mock import patch import numpy from .._msgpack_api import read_msgpack, write_msgpack from .._msgpack_api import msgpack_loads, msgpack_dumps from .._msgpack_api import msgpack_encoders, msgpack_decoders from .util import make_tempdir def test_msgpack_dumps...
StarcoderdataPython
9692824
# -*- coding: utf-8 -*- """ pip_services_runtime.errors.__init__ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Errors module initialization :copyright: Digital Living Software Corp. 2015-2016, see AUTHORS for more details. :license: MIT, see LICENSE for more details. """ __all__ = [ \ 'ErrorCa...
StarcoderdataPython
1726236
<gh_stars>1-10 """ author: <NAME> (SSRL) 4/27/2017 """
StarcoderdataPython
1777882
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- """""" __author__ = 'leferrad' from rl3.agent.feature import LBPFeatureTransformer from rl3.agent.q_learning import QubeRegAgent, QubeTabularAgent, play_one from rl3.environment.base import CubeEnvironment import matplotlib.pyplot as plt import numpy as np ...
StarcoderdataPython
3565347
<gh_stars>1-10 class A: def doStuff(self, foo=True): return True class B(A): def doStuff(self, foo=True): <selection>return A.doStuff(self, foo)</selection> def otherMethod(self, foo, bar): print foo, bar
StarcoderdataPython
3489594
<filename>tests/ludwig/modules/test_encoder.py # Copyright (c) 2019 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 may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
StarcoderdataPython
1731140
from _math import Vector3 from timeit import itertools from elements import GeneratorElement from interactions.constraints import Circle, Constraint, create_constraint_set from interactions.utils.routing import PlanRoute, FollowPath from objects.components.types import ROUTING_COMPONENT from server_commands.argument_he...
StarcoderdataPython
9633786
<reponame>EvgenDEP1/fitness from django.contrib.auth.forms import AuthenticationForm from authapp.models import UserProfile class MyAuthForm(AuthenticationForm): class Meta: model = UserProfile fields = ('username', 'password')
StarcoderdataPython
6424875
<gh_stars>0 import logging import sys from typing import List, Optional, Set, Callable, Dict, Type from langmodels.evaluation.definitions import EvaluationResult from langmodels.evaluation.customization import TokenTypeSubset from langmodels.model import TrainedModel DEFAULT_N_MODEL_SUGGESTIONS = 100 logger = loggi...
StarcoderdataPython