id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
1975892
<gh_stars>0 import os import rdflib from django.conf import settings from rdflib import Graph, Literal, BNode, Namespace, RDF, URIRef, RDFS, ConjunctiveGraph from rdflib.namespace import DC, FOAF, RDFS, XSD from rdflib.namespace import SKOS from places.serializer_arche import place_to_arche, inst_to_arche, person_to_ar...
StarcoderdataPython
1689349
<gh_stars>0 # Copyright 2021 Universität Tübingen, DKFZ and EMBL # for the German Human Genome-Phenome Archive (GHGA) # # 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...
StarcoderdataPython
12829339
<gh_stars>10-100 # from .libload import proxy, register_dll, _register_dll # from .loader import (MassLynxRawLoader, is_waters_raw_dir, # determine_if_available, infer_reader, # IndexEntry, Cycle) # __all__ = [ # "proxy", "register_dll", "_register_dll", # "MassLynxRa...
StarcoderdataPython
8058306
<reponame>duo-labs/py_webauthn import json from typing import Any, Union from .base64url_to_bytes import base64url_to_bytes def _object_hook_base64url_to_bytes(orig_dict: dict) -> dict: """ A function for the `object_hook` argument in json.loads() that knows which fields in an incoming JSON string need t...
StarcoderdataPython
5000927
<reponame>zkan/try-airflow import os AIRFLOW_HOME = os.environ.get('AIRFLOW_HOME') with open(f'{AIRFLOW_HOME}/dags/time.txt') as f: min_data = f.read() mins_list = min_data.split(':') with open(f'{AIRFLOW_HOME}/dags/mins.txt', 'w') as split_text: split_text.write(str(mins_list[1]))
StarcoderdataPython
261266
import pandas as pd import random from sklearn import preprocessing from sklearn import decomposition from sklearn.ensemble import AdaBoostClassifier from sklearn.tree import DecisionTreeClassifier from sklearn import svm from sklearn import feature_selection from sklearn import model_selection from sklearn im...
StarcoderdataPython
8093035
<reponame>jimwaldo/HarvardX-Tools<gh_stars>1-10 #!/usr/bin/env python """ Tests whether a file (in .csv format) with each line, consisting of data about a single student, is anonymous with to a particular level of k. This program will take a set of fields in each line (hard coded, at the moment) and will check to ins...
StarcoderdataPython
156865
<filename>links.py import re import base64 from Crypto.Cipher import AES from Crypto.Protocol.KDF import PBKDF2 from Crypto.Hash import SHA256 import binascii class Link(object): def __init__(self, link, quality, rsk=None): self.link = link self.quality = quality self.rsk = rsk def is...
StarcoderdataPython
12191
from dataclasses import dataclass from typing import List from typing import Union from postmanparser.description import Description from postmanparser.exceptions import InvalidObjectException from postmanparser.exceptions import MissingRequiredFieldException @dataclass class FormParameter: key: str value: s...
StarcoderdataPython
8025296
<filename>arekit/contrib/networks/context/architectures/att_self_p_zhou_rcnn.py from arekit.contrib.networks.attention.architectures.self_p_zhou import self_attention_by_peng_zhou from arekit.contrib.networks.context.architectures.att_self_rcnn import AttentionSelfRCNN class AttentionSelfPZhouRCNN(AttentionSelfRCNN):...
StarcoderdataPython
1932766
#MenuTitle: Print Chars # -*- coding: utf-8 -*- __doc__=""" Print all chars from the font, useful for making specimens. """ for f in Glyphs.fonts: for g in f.glyphs: print g.string,
StarcoderdataPython
1609213
<reponame>lnxpy/ludwig<filename>ludwig/features/sequence_feature.py<gh_stars>0 #! /usr/bin/env python # coding=utf-8 # 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...
StarcoderdataPython
3210732
def persistence(n): nums = [int(x) for x in str(n)] count = 0 while len(nums) != 1: n = 1 for i in nums: n*= i nums = [int(x) for x in str(n)] count+=1 return count
StarcoderdataPython
3208969
import logging import joblib import scipy.sparse as sparce import numpy as np def save_matrix(df,matrix,out_path): id_matrix = sparce.csr_matrix(df.id.astype(np.int64)).T label_matrix = sparce.csr_matrix(df.label.astype(np.int64)).T result = sparce.hstack([id_matrix,label_matrix,matrix],format="csr") ...
StarcoderdataPython
3302867
import glob import subprocess from subprocess import Popen, PIPE import sys import os import shutil sys.path.append(os.environ["COVALENTIZER"]) from Code import * def main(name, argv): if len(argv) != 2: print_usage(name) return timeout = 12*60*60 f = open('log....
StarcoderdataPython
8056297
<filename>ch13/myproject_virtualenv/src/django-myproject/myproject/apps/locations/__init__.py default_app_config = "myproject.apps.locations.apps.LocationsAppConfig"
StarcoderdataPython
1810149
"""Test initialization of VoQ objects, switch, system ports, router interfaces, neighbors, inband port.""" import json import logging import pytest from tests.common.helpers.assertions import pytest_assert from tests.common.helpers.sonic_db import AsicDbCli, VoqDbCli from voq_helpers import check_voq_remote_neighbor, ...
StarcoderdataPython
3546580
<reponame>ArgiesDario/exif """Test deleting EXIF attributes.""" import os import textwrap import unittest from exif import Image from exif.tests.delete_exif_baselines import ( DELETE_ASCII_TAGS_HEX_BASELINE, DELETE_GEOTAG_HEX_BASELINE) # pylint: disable=pointless-statement, protected-access class TestModifyExi...
StarcoderdataPython
6407134
<reponame>sturzl/guet from unittest import TestCase from unittest.mock import Mock from guet.committers.committer import Committer from guet.commands.scriptcommands.commitmsg.commitmsg_strategy import CommitMsgStrategy from guet.context.context import Context class TestCommitMsgStrategy(TestCase): def test_app...
StarcoderdataPython
6692630
# -*- coding: utf-8 -*- """ meraki_sdk This file was automatically generated for meraki by APIMATIC v2.0 ( https://apimatic.io ). """ class MondayModel(object): """Implementation of the 'Monday' model. The schedule object for Monday. Attributes: active (bool): Whether ...
StarcoderdataPython
6517705
#!/usr/bin/env python """<NAME>, Strabourg Astronomical Observatory""" import numpy as np import matplotlib.pyplot as plt from collections import OrderedDict as collections_OrderedDict def ndim_rectangles_integral( # main args func, ...
StarcoderdataPython
12866222
<reponame>VILLASframework/VILLAScontroller from villas.controller.components.manager import Manager from villas.controller.component import Component class GenericManager(Manager): def create(self, payload): component = Component.from_dict(payload.get('parameters')) try: self.add_com...
StarcoderdataPython
9727680
#!/usr/bin/env python # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "L...
StarcoderdataPython
1915228
from django.contrib import admin from .models import DayOfWeek, Request, RequestType, Schedule, TimeSlot admin.site.register([DayOfWeek, Request, RequestType, Schedule, TimeSlot])
StarcoderdataPython
3310593
__author__ = '<NAME>' import unittest from odm.errors import ValidationError from odm import document, fields class TestDocument(unittest.TestCase): def test_choices(self): class FieldContainer(document.BaseDocument): field_integer = fields.IntegerField(choices=[1, 2, 3]) model = Fi...
StarcoderdataPython
16858
<filename>ui/staff.py<gh_stars>0 # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'staff.ui' # # Created by: PyQt5 UI code generator 5.13.0 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(se...
StarcoderdataPython
3240255
<reponame>ariolwork/uni_conditional_gradient from scipy.optimize import linprog import math # от рукинаписанные нужные части numpy from my_numpy import np, my_list eps = 0.00001 # class that contain function, it's derivative and spetial combination for optimization class Func: def __init__(self, func, func_der): ...
StarcoderdataPython
3357601
<reponame>taapp/ohtu-lukuvinkkikirjasto import requests from repositories.user_repository import user_repository class AppLibrary: def __init__(self): self._base_url = "http://localhost:5000" self.reset_application() self._user_repository = user_repository def reset_application(self):...
StarcoderdataPython
6704629
# Generated by Django 3.0.8 on 2021-05-13 12:19 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('products', '0010_productcontent_image'), ] operations = [ migrations.RenameModel( old_name='ButtonContent', new_name='Produc...
StarcoderdataPython
12827060
<reponame>roberthoenig/VQ-VAE-Speech ##################################################################################### # MIT License # # # # Copyright (C) 2018 ...
StarcoderdataPython
3508095
from taskplus.core.shared.action import Action from taskplus.core.shared.response import ResponseSuccess from taskplus.core.shared.request import Request class DeleteUserAction(Action): def __init__(self, repo): super().__init__() self.repo = repo def process_request(self, request): ...
StarcoderdataPython
9728790
<reponame>torkjellsdatter/pisa # author: <NAME> # date: June 29, 2017 """ OscParams: Characterize neutrino oscillation parameters (mixing angles, Dirac-type CP-violating phase, mass splittings) """ from __future__ import division import numpy as np from pisa import FTYPE class OscParams(object): ""...
StarcoderdataPython
8051989
import requests import json import uuid from flask import Flask, request, json, jsonify from flask_restplus import Resource, Api, Resource, reqparse app = Flask(__name__) api = Api(app, title='Unit Test') gtest = api.namespace('gTest', description='Accessible by API and CLI') arq = api.namespace('Arquillian', descri...
StarcoderdataPython
8157720
import Optitrack as OptiT import numpy as np import time import sys import matplotlib.pyplot as plt if __name__ == '__main__': op = OptiT.OptiTrack() current_time = time.time() position = [] begin_time = time.time() fig = plt.figure() ax = fig.add_subplot(projection='3d') ax.set_xlabel('X ...
StarcoderdataPython
4945223
<filename>pretix_cas/views.py import cas from django.conf import settings from django.contrib import messages from django.core.exceptions import ObjectDoesNotExist from django.http import HttpResponse, HttpResponseBadRequest from django.shortcuts import redirect from django.urls import reverse from django.utils.transla...
StarcoderdataPython
299582
<gh_stars>0 #!/usr/bin/env python # # GrovePi Example for using the Grove Thumb Joystick (http://www.seeedstudio.com/wiki/Grove_-_Thumb_Joystick) # # The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi # # Have a question about ...
StarcoderdataPython
12852626
<reponame>jakub530/PyGame-Neural-Net import sys, pygame,math import numpy as np from pygame import gfxdraw import pygame_lib, nn_lib import pygame.freetype from pygame_lib import color import random import copy import auto_maze import node_vis
StarcoderdataPython
4803671
import json import logging import sys import click from click_didyoumean import DYMGroup from esok.config.connection_options import per_connection from esok.constants import UNKNOWN_ERROR LOG = logging.getLogger(__name__) @click.group(cls=DYMGroup) def alias(): """Alias operations.""" pass @alias.command...
StarcoderdataPython
155506
from datadog import initialize, api options = { 'api_key': '<YOUR_API_KEY>', 'app_key': '<YOUR_APP_KEY>' } initialize(**options) list_id = 4741 name = 'My Updated Dashboard List' api.DashboardList.update(list_id, name=name)
StarcoderdataPython
1995669
<gh_stars>1-10 # -*- coding: utf-8 -*- # Copyright (c) 2019, profmagija and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ import frappe.utils.data as fd from frappe.model.document import Document BREAKFAST = 'ACT-00001' LUNCH ...
StarcoderdataPython
9667000
from autoslug import AutoSlugField from django.contrib.auth.models import User from django.contrib.postgres.fields import JSONField, ArrayField from django.db import models, transaction from django.db.models import Q from django.utils.functional import cached_property from django.utils.text import slugify from django.u...
StarcoderdataPython
124246
from django.contrib import admin # Register your models here. from .models import Project admin.site.register(Project)
StarcoderdataPython
6664781
from polyphony import testbench def for15(x): sum = 0 for i in range(0, x): sum += i x = 5 return sum @testbench def test(): assert 0 == for15(0) assert 6 == for15(4) assert 10 == for15(5) test()
StarcoderdataPython
4899091
<reponame>Shikanime/tezos<filename>docs/_extensions/tezos_custom_roles.py from docutils import nodes import os import os.path import re def setup(app): app.add_role('package', package_role) app.add_role('package-name', package_role) app.add_role('package-src', package_role) app.add_role('opam', opam_ro...
StarcoderdataPython
3426510
import json from django.core.management.base import BaseCommand from safe_transaction_service.contracts.tx_decoder import get_db_tx_decoder from ...models import MultisigTransaction class Command(BaseCommand): help = "Exports multisig tx data" def add_arguments(self, parser): parser.add_argument("...
StarcoderdataPython
5171764
<reponame>koliupy/loldib<filename>loldib/getratings/models/NA/na_trundle/na_trundle_bot.py from getratings.models.ratings import Ratings class NA_Trundle_Bot_Aatrox(Ratings): pass class NA_Trundle_Bot_Ahri(Ratings): pass class NA_Trundle_Bot_Akali(Ratings): pass class NA_Trundle_Bot_Alistar(Ratings): ...
StarcoderdataPython
3370031
<reponame>facade-technologies-inc/facile<gh_stars>1-10 # run is the most important function. # one function for one checking algorithm and call all of them in run # targetguimodel and aplmodel are the two things # action is the parent object # actionpipeline, component action and action wrapper all inherited from it ...
StarcoderdataPython
1640830
<filename>bua/caffe/modeling/box_regression.py<gh_stars>1-10 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import math import torch from detectron2.structures import Boxes from typing import List, Tuple, Union # Value for clamping large dw and dh predictions. The heuristic is that we cla...
StarcoderdataPython
286122
<filename>goc/game/Game.py # -*- coding: utf-8 -*- """ Created on Sun Jul 28 13:56:55 2019 @author: Phoenix """ from .stage.WaterStage import WaterStage from .stage.RoomStage import RoomStage from .stage.Lv_Tower_1 import Lv_Tower_1 from .entity.Player import Player from graphics.Background import Background from gr...
StarcoderdataPython
8129551
<gh_stars>0 # Generated by Django 2.2.16 on 2021-04-27 14:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('main', '0138_custom_inventory_scripts_removal'), ] operations = [ migrations.AlterField( model_name='job', ...
StarcoderdataPython
348347
<filename>gsom/applications/zoo_experiment/gsmote/comparison_testing/comparison_test.py # Importing the libraries # import sys # sys.path.append('/content/pygsom/') import datetime import numpy as np from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression from sklearn.ens...
StarcoderdataPython
9709479
<reponame>TugberkArkose/MLScheduler power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power ...
StarcoderdataPython
233500
<reponame>tommycz1/salt-formula-keystone import io import json import logging import sys LOG = logging.getLogger(__name__) import yaml import yaml.constructor try: # included in standard lib from Python 2.7 from collections import OrderedDict except ImportError: # try importing the backported drop-in rep...
StarcoderdataPython
5053522
<filename>tests/test_data_helper.py from unittest import TestCase # TODO implement these tests import numpy as np import pandas as pd import torch from torch.utils.data import WeightedRandomSampler, TensorDataset, DataLoader from sci.data_helpers import SciDataHelper class DataHelperTests(TestCase): def test_n...
StarcoderdataPython
9740209
from __future__ import division import numpy as np import cv2 as cv import os import matplotlib.pyplot as plt def read_image(path): """ Read an image to RGB uint8. Read with opencv (cv) and covert from BGR colorspace to RGB. :param path: The path to the image. :return: RGB uint8 imag...
StarcoderdataPython
4894959
import cv2, collections import numpy inu = input("choose image ") img = cv2.imread("Images/"+str(inu)+".jpg", flags=cv2.IMREAD_COLOR) lower_red = numpy.array([0,50,50]) upper_red = numpy.array([10,255,255]) lower_red2 = numpy.array([165,50,50]) upper_red2 = numpy.array([180,255,255]) hsv = cv2.cvtColor(img, cv2....
StarcoderdataPython
266264
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class Graph(object): __slots__ = ['_tab'] @classmethod def GetRootAsGraph(cls, buf, offset): n = flatbuffers.encode.Get(flatbuf...
StarcoderdataPython
9667061
<reponame>sonocent/daktari import logging import re from semver import VersionInfo from typing import Optional from daktari.check import Check, CheckResult from daktari.command_utils import get_stdout from daktari.os import OS from daktari.version_utils import try_parse_semver flutter_version_pattern = re.compile(r"...
StarcoderdataPython
11266077
from __future__ import print_function import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np from PIL import Image import matplotlib.pyplot as plt import torchvision.transforms as transforms import torchvision.models as models import copy import os import t...
StarcoderdataPython
5063297
# encoding: utf-8 # Created by chenghaomou at 2019-06-11 import argparse import regex as re from elisa_dnt.utils import * if __name__ == "__main__": parser = argparse.ArgumentParser(description='DNT process script') parser.add_argument('step', type=str, choices=['pre', 'post'], help="...
StarcoderdataPython
6569559
<gh_stars>0 from __future__ import print_function """ outputs to produce for RIST workbook: - an asset is a zone-technology-vintage combination x capital outlay for new/replacement assets each period (per asset) - annual amortization for each asset during each period - annual O&M per asset per year - annual fuel cost ...
StarcoderdataPython
11245210
<reponame>danielmicaletti/music-academy-student-portal # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.apps import AppConfig class ScheduleConfig(AppConfig): name = 'schedule'
StarcoderdataPython
4932552
<filename>tools/clipper/bin/train_cascade.py #!/usr/local/bin/python # -*- coding: utf-8 -*- import argparse import os import subprocess import sys import time from pprint import pprint def parsearguments(): parser = argparse.ArgumentParser(description='run cascade training') parser.add_argument('positivefil...
StarcoderdataPython
9789910
# Generated by Django 3.1.7 on 2021-03-23 18:05 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('accounts', '0003_organization_img'), ] operations = [ migrations.AlterField( model_name='organization', name='email'...
StarcoderdataPython
9696690
<gh_stars>1-10 #coding: utf-8 class DCRun(object): def __init__(self): self.status = "invalid" self.target_ips = set([]) def add_valid_room_ip(self, ip): self.target_ips.add(ip) def delete_room_ip(self, ip): try: self.target_ips.remove(ip) finally: pass def view_ips(self):
StarcoderdataPython
8028025
<filename>pytorch-commen-code/code4.py import torch import torchvision ''' # 主要介绍张量操作 ''' ### 张量形变 # 相比torch.view, # torch.reshape可以自动处理输入张量不连续的情况。 tensor = torch.rand(2, 3, 4) shape = (6, 4) tensor = torch.reshape(tensor, shape) ### 打乱顺序 # 打乱第一个维度 tensor = tensor[torch.randperm(tensor.size(0))] ### 水平翻转 # tensor [n,...
StarcoderdataPython
3312880
import argparse import json import os class ConfigParser: def _create_command_line_parser(): """ Specify the expected arguments Returns: parser: An ArgumentParser object from standard library argparse. """ parser = argparse.ArgumentParser() parser.add_argument('-m', '--mode', type=str, choices=['train'...
StarcoderdataPython
71818
#!/usr/bin/python import urllib2 import sys import cv2.cv as cv import numpy if __name__ == "__main__": cv.NamedWindow("camera", 1) capture = cv.CaptureFromCAM(0) paste = cv.CreateMat(960, 1280, cv.CV_8UC3) topleft = numpy.asarray(cv.GetSubRect(paste, (0, 0, 640, 480))) topright = numpy.asarray(c...
StarcoderdataPython
6466270
<reponame>chuwyler/IRISreader #!/usr/bin/env python3 # exception class for corrupt FITS files class CorruptFITSException( Exception ): pass # function that converts wavelength string into extension number def line2extension( header, line ): """ Converts wavelength string into an extension number. Retu...
StarcoderdataPython
9684580
from werkzeug.security import check_password_hash, generate_password_hash import atp_classes ADMIN_USERS_ID = ['5644b9622582d972352da864'] class User: def __init__(self, id, username, password=<PASSWORD>): self._id = id self.username = username self.password = password def is_authent...
StarcoderdataPython
3472823
from simple_rest_client.api import API from . import resource from . import async_resource def get_api_instance(token='', api_root_url=None, timeout=3, resource_class=resource): headers = { 'Authorization': 'Bearer {}'.format(token), 'Content-Type': 'application/json' } file_upload_header...
StarcoderdataPython
70677
#!/usr/bin/python # coding: utf-8 # Copyright (c) 2013 Mountainstorm # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use,...
StarcoderdataPython
6514398
import yaml class GeneralUtils: def __init__(self): self.yaml_dict = None def read_yaml(self, yaml_file: str) -> dict: """ :param yaml_file: This is the path to the yaml file that needs to be read :return: Return a dictionary of the yaml file """ stream = open(...
StarcoderdataPython
12806357
<reponame>SH-anonta/Discussion-Forum from forum.tests.functional_tests.base_testcase import BaseTestCase from forum.tests.functional_tests.page_objects import RegistrationPage class RegistrationTest(BaseTestCase): def loadData(self): pass # Test Case: 56 def test_basicRegistration(self): b...
StarcoderdataPython
65186
<gh_stars>1-10 from __future__ import generators # Python test set -- part 6, built-in types from test.test_support import * print '6. Built-in types' print '6.1 Truth value testing' if None: raise TestFailed, 'None is true instead of false' if 0: raise TestFailed, '0 is true instead of false' if 0L: raise TestFaile...
StarcoderdataPython
1607295
<reponame>ikolokotronis/donation_app """charity_donation_app URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatter...
StarcoderdataPython
1801616
openatv_like = True try: # This works in OpenATV (and similar code bases) but fails on OpenPLi. # The particular import might not be relevant for the actual plugin. from Screens.EpgSelection import SingleEPG ADJUST={'adjust': False} except: ADJUST={} openatv_like = False # Quick fix for Vix try: import bo...
StarcoderdataPython
237538
import shutil import psutil import os.path from os import path def cpuOverUsage(): """Check if is more than 50% usage of cpu in interval of 2 seconds and returns a tuple with False and a message if less than 50%\n True and a message otherwise\n more on https://psutil.readthedocs.io/en/latest/""" ...
StarcoderdataPython
3489057
"""Config flow for habitica integration.""" from __future__ import annotations import logging from aiohttp import ClientResponseError from habitipy.aio import HabitipyAsync import voluptuous as vol from openpeerpower import config_entries, core, exceptions from openpeerpower.const import CONF_API_KEY, CONF_NAME, CON...
StarcoderdataPython
4959916
<reponame>minhhn2910/tensorox #!/usr/bin/python # Designed by: <NAME> # Date: March 26th - 2015 # Alternative Computing Technologies Lab. # Georgia Institute of Technology import sys import random import math def Usage(): print "Usage: python data_generator.py <size> <output file>" exit(1) if(len(sys.argv) != 3):...
StarcoderdataPython
1788765
from . import UP_ENDPOINT, session import json class AccountIDMissingError(Exception): pass class Webhooks(self): """ Webhooks ~~~~~~~~~~~~~~~~~~~~~ Webhooks provide a mechanism for a configured URL to receive events when transaction activity occurs on Up. You can think of webhooks as being like ...
StarcoderdataPython
1671548
""" Divide two integers without using multiplication, division and mod operator. If it is overflow, return 2147483647 Example Given dividend = 100 and divisor = 9, return 11. """ __author__ = 'Daniel' class Solution: def divide(self, dividend, divisor): q = 0 if dividend == 0 or divisor == 0: ...
StarcoderdataPython
4893962
# Copyright (c) 2015 <NAME> # # See the file license.txt for copying permission. import anyio import unittest from distmqtt.mqtt.publish import PublishPacket, PublishVariableHeader, PublishPayload from distmqtt.adapters import BufferAdapter from distmqtt.mqtt.constants import QOS_0, QOS_1, QOS_2 class PublishPacketT...
StarcoderdataPython
385887
import os from params import args os.environ['CUDA_VISIBLE_DEVICES'] = args.gpu from keras.preprocessing.image import img_to_array, load_img from keras.applications.imagenet_utils import preprocess_input from models.model_factory import make_model from os import path, mkdir, listdir import numpy as n...
StarcoderdataPython
5199515
class OsakaBehavior: def print(self): print("TAKOYAKI")
StarcoderdataPython
1854296
import json import os import pytest from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorDatabase from motor_odm import Document @pytest.fixture(scope="function") async def db() -> AsyncIOMotorDatabase: client = AsyncIOMotorClient("localhost") db = client["test"] await client.drop_database(db...
StarcoderdataPython
3410137
<filename>custom/icds/repeaters/phi.py from django.utils.translation import ugettext_lazy as _ from corehq import toggles from corehq.form_processor.models import CommCareCaseSQL from corehq.form_processor.signals import sql_case_post_save from corehq.motech.repeaters.models import CaseRepeater from corehq.motech.repe...
StarcoderdataPython
1985857
# coding=utf-8 # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
StarcoderdataPython
9632049
import os import wandb import tempfile import numpy as np from functools import partial import torch from torch.utils.data import DataLoader from torch.optim import Adam,AdamW from torch.nn.utils import clip_grad_norm_ from oil.datasetup.datasets import split_dataset from oil.utils.utils import LoaderTo, FixedNumpySe...
StarcoderdataPython
8047855
#!/usr/bin/env python r"""Test spacecraft class. """ import pdb import numpy as np import pandas as pd import unittest import pandas.testing as pdt from scipy import constants from unittest import TestCase from abc import ABC, abstractclassmethod, abstractproperty # import test_base as base from solarwindpy.tests impo...
StarcoderdataPython
5136792
import numpy as np import matplotlib.pyplot as plt import os ################# # Load the tuple ################# folder = './' name = 'rbm_tuple' extension = '.npy' tuple = np.load(folder + name + extension) weights = tuple[0] # This is the weights samples = tuple[1] # This is the actual sampling vis_samples = t...
StarcoderdataPython
12800649
import os import shutil import tkinter as tk from tkinter import filedialog from tkinter import messagebox import cv2 import numpy as np from PIL import Image from PIL import ImageTk class Button: def __init__(self, root, frame3): self.root = root self.frame3 = frame3 self...
StarcoderdataPython
1635856
import conans class ProjectConan(conans.ConanFile): generators = "cmake", "virtualenv" requires = ( "gtest/1.10.0" ) default_options = ( "gtest:shared=False" )
StarcoderdataPython
5035207
import os import cv2 import numpy as np from scipy.ndimage.morphology import binary_dilation from flask import Flask, request, redirect, url_for, send_from_directory from werkzeug import secure_filename UPLOAD_FOLDER = '/Users/charleslai/Documents/Programming/other-projects/waldoBot/server/imgs' UPLOAD_FOLDER = '/User...
StarcoderdataPython
4903321
<reponame>SimonSuster/allennlp # pylint: disable=no-self-use,invalid-name,protected-access from typing import List import pytest from allennlp.common.testing import AllenNlpTestCase from allennlp.semparse import DomainLanguage, ExecutionError, ParsingError, predicate class Arithmetic(DomainLanguage): def __init_...
StarcoderdataPython
175743
""" /llrws/__init__.py Concerns all things LLR Web Suite. """ from flask import Flask from flask_cors import CORS from flask_restful import Api from llrws.config import Config from llrws.api.routes import initialize_routes application = Flask(__name__) def create_app(config_class=Config): """Creates Flask app...
StarcoderdataPython
5014440
<gh_stars>1-10 """Eze's Languages module""" from __future__ import annotations import os import pathlib import re from abc import ABC, abstractmethod from pathlib import Path from typing import Callable from pydash import py_ from eze.core.config import EzeConfig from eze.core.enums import ( SourceType, LICE...
StarcoderdataPython
5142739
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import copy import json import os import shutil from maro.cli.process.utils.details import env_prepare, load_details from maro.cli.utils.params import LocalPaths, ProcessRedisName from maro.utils.logger import CliLogger logger = CliLogger(name=...
StarcoderdataPython
5071412
from django.contrib.auth import get_user_model from rest_framework import serializers from mime.mime.models import Mime User = get_user_model() class MimeSerializer(serializers.ModelSerializer): """Mime serializer""" # Attach user to mime owner = serializers.ReadOnlyField(source="owner.username") ...
StarcoderdataPython
207463
# 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 applicable law or agreed to in...
StarcoderdataPython