id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3361790
<reponame>nearj/mpvr-motionfiltering # coding: utf-8 import glob import numpy as np import pandas as pd import matplotlib.pyplot as plt import config.definitions as defs time_tag = 'Time' incidence_tag = 'DizzinessRange' res = [f for f in glob.glob(defs.DATA_RAW_MOTION_DIR + "*.csv") if "3DI" in f and "3DI_0" not in f...
StarcoderdataPython
3306374
<reponame>iharthi/cargo-scanner<filename>cargoscan.py #!/usr/bin/env python2 from __future__ import print_function import serial_led import random import pygame as pg import argparse import draw import os ports = serial_led.SerialLedController.port_list() default_alarm = os.path.join(os.path.split(os.path.realpath(_...
StarcoderdataPython
43574
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import os from collections import defaultdict import numpy as np from scipy.spatial import distance from tqdm import tqdm np.set_printoptions(threshold=np.inf, suppress=True) def main(args): num_batches = args.num_batches bert_data = defaultdic...
StarcoderdataPython
3225008
from rest_framework import status from rest_framework.permissions import AllowAny from rest_framework.response import Response from rest_framework.views import APIView from rest_framework.viewsets import ReadOnlyModelViewSet from .models import ExchangeRate from .serializers import ExchangeRateSerializer from .tasks i...
StarcoderdataPython
170803
# -*- coding: utf-8 -*- from __future__ import print_function, division, unicode_literals from __future__ import absolute_import import numpy as np, time, sys, smbus # default addresses and ChipIDs of Bosch BMP 085/180 and BMP/E 280 sensors BMP_I2CADDR = 0x77 BMP_I2CADDR2 = 0x76 #BMP_I2CADDR = 0x76 # alternative dev...
StarcoderdataPython
1766306
<filename>src/python/detectors/hashlib_constructor/hashlib_constructor.py # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 # {fact rule=hashlib-constructor@v1.0 defects=1} def constructor_noncompliant(): import hashlib text = "ExampleString" # N...
StarcoderdataPython
3222772
<reponame>DPBayes/robust-private-lr<filename>python/synthdata/test_rlr.py #!/bin/env python3 # Differentially private Bayesian linear regression # <NAME> 2016-2017 # University of Helsinki Department of Computer Science # Helsinki Institute of Information Technology HIIT # Synthetic data # Precision measure: MSE # Ru...
StarcoderdataPython
1689164
<filename>examples/countries/src/main.py import time from jobs import count_eur_currency_countries if __name__ == '__main__': codes = [] with open('countries.txt', 'r') as f: for line in f.readlines(): codes.append(line.split()[0]) start_time = time.time() count_eur_currency_count...
StarcoderdataPython
1734736
from app import db, login_manager from flask_login import UserMixin from datetime import datetime @login_manager.user_loader def load_user(id): return User.query.get(int(id)) class Marking(db.Model): __tablename__ = "marking" marker_id = db.Column(db.Integer, db.ForeignKey('user.id'), primary_key=True) marked_id ...
StarcoderdataPython
4833151
import re from collections import defaultdict from datetime import date, timedelta from artifactory import ArtifactoryPath from teamcity.messages import TeamcityServiceMessages from artifactory_cleanup.rules.base import Rule TC = TeamcityServiceMessages() class RuleForDocker(Rule): """ Parent class for Doc...
StarcoderdataPython
3244301
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class DataTag(object): def __init__(self): self._aggregate = None self._alias = None self._code = None @property def aggregate(self): return self._aggregate ...
StarcoderdataPython
1760286
numero=int(input("Ingrese el numero: ")) contador=0 for i in range (1,numero+1): if numero%i==0: contador=contador+1 if contador==2: print("el numero es primo") else: print("el numero no es primo")
StarcoderdataPython
97043
<reponame>Neural-Plasma/deepDiffusion<gh_stars>0 import numpy as np from os.path import join as pjoin import config def dataxy(f,m,u): f["/%d"%int(m)] = u # f["/%d"%int(t)+"/energy"] = KE # dsetE.resize(dsetE.shape[0]+1, axis=0) # dsetE[-1:] = KE # # dsetQ.resize(dsetQ.shape[0]+1, axis=0) ...
StarcoderdataPython
1792646
<filename>revitron/export.py """ The ``export`` submodule hosts all classes related to sheet export such as **DWG** and **PDF**. For example sending the currently active sheet to a PDF printer in the network works as follows:: exporter = revitron.PDFExporter(printerAddress, printerPath) exporter.printSheet(rev...
StarcoderdataPython
103231
# Generated by Django 3.0.7 on 2020-06-29 03:46 from django.db import migrations import jutil.modelfields class Migration(migrations.Migration): dependencies = [ ("jacc", "0021_auto_20191209_2231"), ] operations = [ migrations.AlterField( model_name="account", na...
StarcoderdataPython
3261691
# -*- encoding: utf-8 -*- ''' @project : LeetCode @File : replaceWords.py @Contact : <EMAIL> @Desc : 在英语中,我们有一个叫做 词根(root)的概念,它可以跟着其他一些词组成另一个较长的单词——我们称这个词为 继承词(successor)。例如,词根an,跟随着单词 other(其他),可以形成新的单词 another(另一个)。 现在,给定一个由许多词根组成的词典和一个句子。你需要将句子中的所有继承词用词根替换掉。如果继承词有许多可以形成它的词根,则用最短...
StarcoderdataPython
97071
from cytoolz import cons from cytoolz import merge from merlin import specs def test_only(): registry = [{'key': 1, 'ubid': 'a'}, {'key': 2, 'ubid': 'b'}, {'key': 3, 'ubid': 'c'}, {'key': 4, 'ubid': 'd'}] expected = tuple([{'key': 1, 'ubid': 'a'}, {'key': 4, 'ubid': 'd'}]) result = spec...
StarcoderdataPython
34056
# Author: btjanaka (<NAME>) # Problem: (UVa) 247 import sys from collections import defaultdict def kosaraju(g, g_rev): order = [] visited = set() def visit(u): visited.add(u) for v in g[u]: if v not in visited: visit(v) order.append(u) for u in g...
StarcoderdataPython
1787748
import uuid def generate_vehicle_id(): return 'veh_' + uuid.uuid4().hex
StarcoderdataPython
53600
from noval import GetApp,_ import noval.iface as iface import noval.plugin as plugin import tkinter as tk from tkinter import ttk,messagebox import noval.preference as preference from noval.util import utils import noval.ui_utils as ui_utils import noval.consts as consts MAX_WINDOW_MENU_NUM_ITEMS = 30 ##c...
StarcoderdataPython
3280168
<reponame>mikando/salvia-blockchain from typing import Any, Dict, List, Optional import aiohttp from salvia.cmds.units import units from salvia.consensus.block_record import BlockRecord from salvia.rpc.farmer_rpc_client import FarmerRpcClient from salvia.rpc.full_node_rpc_client import FullNodeRpcClient from salvia.r...
StarcoderdataPython
183013
<reponame>bovarysme/advent def pairs(digits): for i in range(len(digits) - 1): yield digits[i], digits[i+1] yield digits[-1], digits[0] def halfway(digits): half = len(digits) // 2 for i in range(half): yield digits[i], digits[half+i] for i in range(half, len(digits)): yi...
StarcoderdataPython
1603417
<gh_stars>0 """ Class :py:class:`CMWMain` is a QWidget for interactive image ============================================================ Usage :: import sys from PyQt5.QtWidgets import QApplication from psana.graphqt.CMWMain import CMWMain app = QApplication(sys.argv) w = CMWMain(None, app) w...
StarcoderdataPython
3384277
<filename>mysite/domain/article/value_objects.py<gh_stars>1-10 from dataclasses import dataclass from typing import ( Optional, ) from domain.common.file import ( File, ) ArticleId = int Cursor = str @dataclass(frozen=True) class ArticleInput: title: str description: str id: Optional[int] = No...
StarcoderdataPython
143036
#!/usr/bin/env python3 # -*- encoding:utf-8 -*- import os import logging from flask import Flask, redirect, url_for from flask_mdict import __version__, init_app, mdict_query2 logger = logging.getLogger(__name__) def create_app(mdict_dir='content'): logging.basicConfig( level=20, format='%(mes...
StarcoderdataPython
1725452
<reponame>FusionSolutions/python-fssignal # Builtin modules from __future__ import annotations import traceback, signal as _signal from threading import Event from time import monotonic, sleep from typing import Callable, Dict, Any, Iterator, Iterable, Optional, Union, Type # Third party modules # Local modules # Prog...
StarcoderdataPython
3330176
<reponame>GolemZ2K/SimpleNTP #!/usr/bin/env python3 #coding:utf-8 ''' Simple time synchronizer, to synchronization time in a lan. usage: python3 sntp.py [-h] [-s] [-i interval] SimpleNtp server and client optional arguments: -h, --help show this help message and exit -s run as ntp server -i interv...
StarcoderdataPython
1764743
# Copyright 2019-2021 Huawei Technologies Co., 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 applicable law or agre...
StarcoderdataPython
3359549
from .dataset import Dataset from .repository import Repository, StaticRepository __all__ = [ 'Dataset', 'Repository', 'StaticRepository', ]
StarcoderdataPython
4803164
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Check if pickle can serialize CoTeDe's dataset. This is critical to allow running CoTeDe with multiprocessing. """ import pickle import numpy as np from cotede.qc import ProfileQC from data import DummyData def test_serialize_ProfileQC(): """ Serializ...
StarcoderdataPython
3208446
<reponame>jasonsbrooks/ARTIST #!/usr/bin/env python """ Train an ngram model $ python -m ngram.train -o outdir [-t poolsize] [-k key] [-u username] [-p password] where: - `outdir` is where the trained models will be saved - `poolsize` is the number of databases - `key` is the key to save the models i...
StarcoderdataPython
1675887
from lwr.lwr_client.action_mapper import from_dict def preprocess(job_directory, setup_actions): for setup_action in setup_actions: name = setup_action["name"] input_type = setup_action["type"] action = from_dict(setup_action["action"]) path = job_directory.calculate_path(name, inp...
StarcoderdataPython
1752060
<filename>tests/test_rfc6962.py from ctutlz import rfc6962 def test_parse_log_entry_type_0(): tdf = b'\x00\x00' parse, offset = rfc6962._parse_log_entry_type(tdf) assert offset == 2 assert parse == { 'tdf': b'\x00\x00', 'val': 0, } def test_parse_log_entry_type_1(): tdf = b...
StarcoderdataPython
1756802
import pandas as pd def kinase_rank(heatmap, df1, df2, predictor_idx, predictor_col): """ Sort the Jaccard's Index for each kinases from the two compared predictors (index, columns) in given heatmap. Parameters ---------- heatmap: dataframe Jaccard's Index matrix df1...
StarcoderdataPython
1737264
import numpy as np def gini(labels): total_size = len(labels) label_quantities = np.unique(labels, return_counts=True) sum_of_probs_sq = 0 for num_of_elem in label_quantities[1]: sum_of_probs_sq += (num_of_elem / total_size) ** 2 return 1 - sum_of_probs_sq
StarcoderdataPython
81331
<filename>src/BeautifulSoupExample.py from bs4 import BeautifulSoup import requests URL_BASE = "http://jarroba.com/" MAX_PAGES = 20 counter = 0 for i in range(1, MAX_PAGES): # Construyo la URL if i > 1: url = "%spage/%d/" % (URL_BASE, i) else: url = URL_BASE # Realizamos la petición ...
StarcoderdataPython
3307530
""" python -c "import cyth, doctest; print(doctest.testmod(cyth.cyth_macros))" """ from __future__ import absolute_import, division, print_function import parse import re from functools import partial from .cyth_decorators import macro def parens(str_): return '(' + str_ + ')' def is_constant(expr, known_consta...
StarcoderdataPython
3325999
<reponame>z3r0zh0u/pyole #!/usr/bin/env python """ pyvba example: file classification based on file format currently support files in following format: * ole format * openxml format * mhtml format * base64 encoded mhtml format """ import os import re import sys import time import zlib import shutil import base64 impo...
StarcoderdataPython
3390649
<filename>level3.py from star import Star from levelbase import LevelBase import jngl class Level(LevelBase): def __init__(self): LevelBase.__init__(self) self.stars = [] for x in range(170, 770, 160): for y in range(250, 430, 160): self.stars.append(Star(x, y, "...
StarcoderdataPython
11987
# Generated by Django 2.2.4 on 2019-08-14 09:13 from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("order", "0071_order_gift_cards")] operations = [ migrations.RenameField( model_name="order", old...
StarcoderdataPython
4831684
<gh_stars>1-10 #!/usr/bin/env python3 from olctools.accessoryFunctions.accessoryFunctions import combinetargets, MetadataObject, make_path, \ run_subprocess, SetupLogging from olctools.databasesetup import enterobase_api_download, get_mlst, get_rmlst from datetime import datetime from argparse import ArgumentParser...
StarcoderdataPython
180723
"""Command models to wait for target temperature of a Temperature Module.""" from __future__ import annotations from typing import Optional, TYPE_CHECKING from typing_extensions import Literal, Type from pydantic import BaseModel, Field from ..command import AbstractCommandImpl, BaseCommand, BaseCommandCreate if TYP...
StarcoderdataPython
1652892
nome = str(input('Digite o seu nome: ')).lower().strip() if nome == 'talyson': print('Que nome bonito!') #elif nome == 'andré' or nome =='alves': # print('Nome muito bonito também!') elif nome in '<NAME>': print('Nome daora, parça') print(f'Tenha um ótimo dia, {nome}!')
StarcoderdataPython
94984
<reponame>prateeksingh0001/FlexNeuART<filename>scripts/py_flexneuart/utils.py<gh_stars>0 """Misc FlexNeuART utils.""" from jnius import autoclass JHashMap = autoclass('java.util.HashMap') def dict_to_hash_map(dict_obj): """Convert a Python dictionary to a Java HashMap object. Caution: values in the dictio...
StarcoderdataPython
3277250
from utils.db.mongo_orm import * # 类名定义 collection class TestReportDetail(Model): class Meta: database = db collection = 'testReportDetail' # 字段 _id = ObjectIdField() # reportDetailId reportId = ObjectIdField() projectId = ObjectIdField() testSuiteId = ObjectIdField() tes...
StarcoderdataPython
84197
<reponame>f1uzz/shadow<filename>shadow/__main__.py from shadow import main main()
StarcoderdataPython
1702544
<reponame>Epistoteles/Modergator<filename>ocr-api/text_scene_detection_utility.py from model.craft import CRAFT import model.craft_utils as craft_utils import torch from collections import OrderedDict import torch.backends.cudnn as cudnn import time import numpy as np import model.imgproc as imgproc import cv2 from tor...
StarcoderdataPython
3310007
<filename>LeetCodeSolutions/python/49_Group_Anagrams.py class Solution(object): def groupAnagrams(self, strs): """ :type strs: List[str] :rtype: List[List[str]] """ d = {} for s in sorted(strs): key = tuple(sorted(s)) d[key] = d.get(key, []) + ...
StarcoderdataPython
161285
<reponame>biothings/mychem.info<filename>src/hub/dataload/sources/unii/unii_upload.py import os import glob from .unii_parser import load_data from hub.dataload.uploader import BaseDrugUploader import biothings.hub.dataload.storage as storage from biothings.hub.datatransform import DataTransformMDB from hub.datatrans...
StarcoderdataPython
3353516
import cProfile from agents.agent_mcts import generate_move from main import human_vs_agent cProfile.run( "human_vs_agent(generate_move, generate_move)", "mmab.dat" ) import pstats # from pstats import SortKey with open("output_time.txt", "w") as f: p = pstats.Stats("mmab.dat", stream=f) p.sort_stats("ti...
StarcoderdataPython
53612
<gh_stars>0 #!/usr/bin/env python import sys, os, time, urllib, urllib.request, shutil, re, lxml, threading, queue, multiprocessing import hashlib from bs4 import BeautifulSoup from urllib.parse import urlparse from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.sup...
StarcoderdataPython
1775803
<filename>backend/api/auth/serializers.py from django.db.migrations import serializer from rest_framework import serializers from account.models import User class SerializerUser(serializers.ModelSerializer): """ Classe de Serialização do Model Usuario """ class Meta: model = User ...
StarcoderdataPython
4832591
# -*- coding:utf-8 -*- """ Simple static page generator. Uses Jinja2 to compile templates. """ from __future__ import absolute_import, print_function import inspect import logging import os import re import shutil import warnings from jinja2 import Environment, FileSystemLoader from .reloader import Reloader de...
StarcoderdataPython
157275
import os from pathlib import Path import torch from torch.utils.data import DataLoader from tqdm.auto import tqdm import logging from data_aug.utils import set_seeds from data_aug.models import ResNet18 from data_aug.datasets import get_cifar10 from bnn_priors.third_party.calibration_error import ece @torch.no_grad...
StarcoderdataPython
3879
<filename>src/cms/forms/languages/language_form.py from django import forms from ...models import Language class LanguageForm(forms.ModelForm): """ Form for creating and modifying language objects """ class Meta: model = Language fields = [ "code", "english_na...
StarcoderdataPython
187093
<reponame>Ali-Parandeh/Data_Science_Playground # Create database engine for data.db engine = create_engine('sqlite:///data.db') # Write query to get date, tmax, and tmin from weather query = """ SELECT date, tmax, tmin FROM weather; """ # Make a data frame by passing query and engine to read_sql() t...
StarcoderdataPython
48454
# -*- coding: utf-8 -*- # Generated by Django 1.11a1 on 2017-05-11 08:37 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='allBoo...
StarcoderdataPython
3265355
from homebrain import Agent, Event, Dispatcher class IDFilter(Agent): """Listens to a certain trigger event, and emits a target event once the specified count has been reached.""" autostart = False def __init__(self, ID, target=None): Agent.__init__(self) self.target = target if target i...
StarcoderdataPython
1638333
from datetime import datetime import base64 import fudge from nose.tools import eq_ as eq from onelogin.saml.test.util import assert_raises from onelogin.saml import ( Response, ResponseValidationError, ResponseNameIDError, ResponseConditionError, ) test_response = """<samlp:Response xmlns:sa...
StarcoderdataPython
1644730
<gh_stars>0 # -*- coding: utf-8 -*- """Homework 5.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1wEyRe0MurtqVNBeqe0w4Sp20QUJktjHa """ import pandas as pd """Take 10 candidates and find what packs commited to them and where those packs are loca...
StarcoderdataPython
1640435
<reponame>andreped/GSI-RADS<gh_stars>0 from segmentation.src.Utils.configuration_parser import * from segmentation.src.PreProcessing.pre_processing import run_pre_processing from segmentation.src.Inference.predictions import run_predictions from segmentation.src.Inference.predictions_reconstruction import reconstruct_p...
StarcoderdataPython
1657430
from django.core.management.base import BaseCommand, CommandError from django.db.models import Q from django.core.exceptions import MultipleObjectsReturned from mighty import functions from mighty.apps import MightyConfig as conf from mighty.applications.logger.apps import LoggerConfig import datetime, sys, logging lo...
StarcoderdataPython
24719
<filename>spec/python/test_cast_nested.py<gh_stars>10-100 # Autogenerated from KST: please remove this line if doing any edits by hand! import unittest from cast_nested import CastNested class TestCastNested(unittest.TestCase): def test_cast_nested(self): with CastNested.from_file('src/switch_opcodes.bin...
StarcoderdataPython
1716359
<filename>lib/figures.py """ @author: <NAME> https://github.com/diegoscastanho """ import matplotlib.pyplot as plt import numpy as np class PlotGraphics: """ Plot graphics """ def __init__(self, obj): self.database = obj.database_radiobutton.isChecked() self.real_prediction_test = obj.r...
StarcoderdataPython
1608628
<reponame>patricebechard/chatbot<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- """ @author: <NAME> @email: <EMAIL> Created on Thu Jan 18 17:45:44 2018 Utilities for the seq2seq chatbot """ import time import math import torch device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") # USE_C...
StarcoderdataPython
4838276
# Copyright 2020 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
1772683
<gh_stars>100-1000 """ Battle commands. They only can be used when a character is in a combat. """ from evennia.utils import logger from muddery.server.commands.base_command import BaseCommand from muddery.server.utils.localized_strings_handler import _ class CmdCombatInfo(BaseCommand): """ Get combat info. ...
StarcoderdataPython
157545
# -*- coding: utf-8 -*- # # Copyright 2020 Google 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/licenses/LICENSE-2.0 # # Unless requir...
StarcoderdataPython
4808547
<filename>test/end-to-end/Graphs/Python/algorithms/depth_first_search.py from data.unweighted_node import UnweightedNode from data.weighted_node import WeightedNode def unweighted_depth_first_search(start): nodes = [] visited = set() traverse_unweighted_depth_first_search(start, nodes, visited) retur...
StarcoderdataPython
1633626
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 9 22:56:24 2020 @author: <NAME> Input files: quantification tsv file Output file: pdf files Description: Used to plot scatter plots of technical replicates """ import argparse import pandas as pd import matplotlib #do not use Xwindows backend m...
StarcoderdataPython
1772373
import inspect class ProblemSizeCounter: def __init__ (self, J, F, L, M, P): self._initNumberOfVariables(J, F, L, M, P) self._initNumberOfConstraints(J, F, L, M, P) def _initNumberOfVariables(self, J, F, L, M, P): self.numberOfVariablesX = P * L * F self.numberOfVariablesY = ...
StarcoderdataPython
3314972
from pyutilib.component.core import * class IPackage2Util(Interface): """Interface for Package2 utilities""" class Package2Util(Plugin): implements(IPackage1Util)
StarcoderdataPython
3206104
class LineOutput: """ default output class, output key and value as (key, value) pair separated by separator """ @staticmethod def collect(key, value, separator = '\t'): """ collect the key and value, output them to a line separated by a separator character ...
StarcoderdataPython
4819967
<filename>tests/test_falcon_idempotency.py import falcon import pytest from falcon import testing def resolve_request_method(client, request_method): """ Simple utility which can be used to ease the burden of parametrizing for POST and DELETE metods Parameters ---------- c...
StarcoderdataPython
3264835
<reponame>bcornelusse/microgrid-bench<filename>microgrid/model/generator.py from microgrid.model.device import Device class Generator(Device): def __init__(self, name, params): """ :param name: Cf. parent class :param params: dictionary of params, must include a capacity value , ...
StarcoderdataPython
1702383
import os def init(): if not os.path.exists('db.json'): import json from collections import OrderedDict init_data = OrderedDict() accounts = OrderedDict() notes = OrderedDict() init_data['auto_named'] = 0 init_data['accounts'] = accounts init_data[...
StarcoderdataPython
3326050
from django.core.management.base import BaseCommand from fluff.pillow import FluffPillowProcessor from pillowtop.utils import get_pillow_by_name class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( 'pillow_name', ) parser.add_argument( ...
StarcoderdataPython
1614996
import torch import torch.nn as nn import torch.nn.functional as F import torchvision from classifier.config import configurable from .utils import * from .build import ARCHITECTURE_REGISTRY @ARCHITECTURE_REGISTRY.register() class resnet18mtl(nn.Module): @configurable def __init__(self, in_chan=3, out_chan=[...
StarcoderdataPython
87817
<reponame>QuintonWeenink/distributed-system import json import subprocess execfile("member.py") class Clue: def __init__(self, id, data): self.data = data self.id = id class iRummy: def __init__(self, crewSize, port): print json.dumps(self.wake()) print json.dumps(self.prepar...
StarcoderdataPython
27134
<reponame>jdavidagudelo/tensorflow-models<filename>research/steve/toy_demo.py from __future__ import division from __future__ import print_function from builtins import range from past.utils import old_div # Copyright 2018 The TensorFlow Authors All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (t...
StarcoderdataPython
3371307
<filename>cliport/eval.py """Ravens main training script.""" import os import pickle import json import numpy as np import hydra from cliport import agents from cliport import dataset from cliport import tasks from cliport.utils import utils from cliport.environments.environment import Environment @hydra.main(confi...
StarcoderdataPython
1630918
<reponame>ryankurte/codechecker # ------------------------------------------------------------------------- # # Part of the CodeChecker project, under the Apache License v2.0 with # LLVM Exceptions. See LICENSE for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # -------------------...
StarcoderdataPython
1710470
<gh_stars>10-100 from mocap_dataset import MocapDataset from skeleton import Skeleton import numpy as np import os skeleton_H36M = Skeleton(offsets=[ [ 0. , 0. , 0. ], [-132.948591, 0. , 0. ], [ 0. , -442.894612, 0. ], [ 0. , -454...
StarcoderdataPython
1625460
""" Define a GRB object holding BATSE data associated with a single GRB trigger, and a GRBCollection to hold GRB instances for many GRBs. Created 2012-05-06 by <NAME> (adapted from an earlier version for the 4B catalog) """ from collections import OrderedDict from os.path import join, exists from os import mkdir impo...
StarcoderdataPython
1772698
<reponame>aolarchive/Hydro __author__ = 'yanivshalev'
StarcoderdataPython
1678482
"""Unit tests for database components.""" import unittest import pyodbc from shared.utils import get_test_case_name class TestDb(unittest.TestCase): """Unit tests for database components.""" @classmethod def setUpClass(cls): """Execute this before the tests.""" cls.connection = TestDb.get...
StarcoderdataPython
3368253
# coding: utf-8 """ Project Euler problem #36. """ def problem(): u""" Solve the problem. The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 7...
StarcoderdataPython
1612368
<reponame>iamdaguduizhang/Small_module # -*- coding:utf-8 -*- # @Time : 2019/10/10 10:57 # @Author : Dg import datetime import time from multiprocessing import Process def sleep(data): time.sleep(data) print("休息{}秒".format(data)) if __name__ == "__main__": print(datetime.datetime.now()) p1 = Proce...
StarcoderdataPython
1716105
<filename>test/api/document/test_load_web_document.py # ----------------------------------------------------------------------------------- # <copyright company="Aspose" file="test_load_web_document.py"> # Copyright (c) 2020 Aspose.Words for Cloud # </copyright> # <summary> # Permission is hereby granted, free of c...
StarcoderdataPython
1705937
<gh_stars>1-10 #Qiita API v2対応 import sys, json, requests, re from QiitaAPI import * class QiitaAPIv2(QiitaAPI): #v2 APIのベースURL BASEURL='https://qiita.com/api/v2/' #V2 APIの要素定義 API_PROP_TITLE='title' API_PROP_ITEMID='id' API_PROP_URL='url' API_PROP_TAGS='tags' API_PROP_USER='user' API_PROP_VIEW='page_views_c...
StarcoderdataPython
1690653
<reponame>leonhard-s/auraxium """Base classes for the Auraxium object model. These classes define shared functionality required by all object representations of API data, and defines the basic class hierarchy used throughout the PlanetSide 2 object model. """ import abc import logging from typing import Any, ClassVar...
StarcoderdataPython
193550
from env_common import get_screen from common import select_action_policy import torch import torch.nn as nn import torch.nn.functional as F from torch.optim import RMSprop from itertools import count import numpy as np import gym import visdom device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # ...
StarcoderdataPython
3361623
<filename>adjutant_ui/content/forgot_password/forms.py # Copyright (c) 2016 Catalyst IT 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 # #...
StarcoderdataPython
1651693
from PeptideBuilder import Geometry import PeptideBuilder import Bio.PDB from Bio.PDB import calc_angle, rotaxis, Vector from math import * import numpy as np def bytes2string(tbt_array): return tbt_array.numpy().astype(dtype=np.uint8).tostring().split(b'\00')[0].decode("utf-8") def generateAA(aaName): geo = Geom...
StarcoderdataPython
1769069
import copy import falcon import json import os import shutil import subprocess import sys import traceback from datetime import datetime, timedelta from sqlalchemy import func, desc from sqlalchemy.exc import SQLAlchemyError import model import endpoint import util from db import engine, session from util import User...
StarcoderdataPython
37343
<filename>src/code/data-structures/DoublyLinkedList/DoublyLinkedList.py<gh_stars>0 class DoublyLinkedList: """ Private Node Class """ class _Node: def __init__(self, value): self.value = value self.next = None self.prev = None def __str__(self): r...
StarcoderdataPython
3371981
<filename>python/multiprocessingHttpRequests.py #!/usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2020 damian <<EMAIL>> # # Distributed under terms of the MIT license. import concurrent.futures import requests URLS = [ 'http://httpbin.org/get', 'http://httpbin.org/get', ...
StarcoderdataPython
3241519
<reponame>FRANCISAnas/django-on-aws import json from os import getenv import urllib3 http = urllib3.PoolManager() def handler(event, context): """Lambda function to forward SNS notifications to Slack""" try: # Initialize variables url = getenv("SLACK_WEBHOOK_URL") text = event["Recor...
StarcoderdataPython
174520
from django import forms from django.core.exceptions import ValidationError from .models import Process class ProcessCancelForm(forms.ModelForm): def __init__(self, user=None, **kwargs): self.user = user super(ProcessCancelForm, self).__init__(**kwargs) def clean(self): data = super(P...
StarcoderdataPython
3253814
<gh_stars>1-10 from os.path import join, dirname, abspath import sys sys.path.append(dirname(dirname(abspath(__file__)))) try: import jackal_navi_envs except: pass import gym import numpy as np try: sys.path.remove('/opt/ros/melodic/lib/python2.7/dist-packages') except: pass import torch from torch imp...
StarcoderdataPython