id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3224400
<reponame>Xaxetrov/OSCAR<filename>oscar/meta_action/train_unit.py<gh_stars>1-10 from oscar.util.selection import * def train_unit(obs, building_id, action_train_id): command_center = find_position(obs, building_id) return [actions.FunctionCall(SELECT_POINT, [NEW_SELECTION, command_center]), action...
StarcoderdataPython
4816540
<gh_stars>0 from flask_restplus import fields from polylogyx.blueprints.v1.external_api import api node_config = api.model('node_full_config_wrapper', { 'status': fields.String(description=u'status'), 'message': fields.String(description=u'message about the status'), 'data': fields.Raw(description=u'data i...
StarcoderdataPython
3375915
<reponame>Z8ara/tiktokpy<gh_stars>0 from typing import List from playwright.async_api import Response, Route from tiktokpy.utils.logger import logger async def block_resources_and_sentry(route: Route, types: List[str]): is_blocked = False if route.request.resource_type in types: is_blocked = True ...
StarcoderdataPython
95150
<filename>python/lib/sldr/ldml_exemplars.py #!/usr/bin/python # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and...
StarcoderdataPython
3292452
from radon.complexity import average_complexity, cc_visit from radon.raw import analyze from radon.metrics import h_visit import fileExplorer from os import remove, path class Analyser: def __init__(self, filename): with open(filename) as fobj: self.sourceFile = fobj.read() self.rawMetrics = self.generateRawMe...
StarcoderdataPython
112707
<reponame>truekonrads/mirv-metasploit #!/usr/bin/env python # # this program is used to find source code that includes linux kernel headers directly # (e.g. with #include <linux/...> or #include <asm/...>) # # then it lists import sys, cpp, glob, os, re, getopt, kernel from utils import * from defaults import * progr...
StarcoderdataPython
1712123
<reponame>zssherman/cmac2.0 """ Sonde check attempts to read each sonde file with netCDF4, error files are sent to a new directory. """ import glob import os import shutil import stat import netCDF4 files = glob.glob('/lustre/or-hydra/cades-arm/proj-shared/sgpsondewnpnC1.b1/*') for file in files: try: ...
StarcoderdataPython
3354666
<reponame>Akasiek/scorethatlp<filename>django/reviewApp/migrations/0046_review_updated_at.py # Generated by Django 4.0.3 on 2022-03-14 21:11 from django.db import migrations, models from django.utils import timezone class Migration(migrations.Migration): dependencies = [ ('reviewApp', '0045_alter_album_...
StarcoderdataPython
3276434
<reponame>lijiansong/lang #!/usr/bin/env python import sound if __name__ == '__main__': pass
StarcoderdataPython
54081
<reponame>krikru/efficientnet # Copyright 2019 The TensorFlow Authors, <NAME>. 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/LICE...
StarcoderdataPython
3373753
<filename>main.py #!/usr/bin/env python3 """ Example collector script for NetFlow v9. This file belongs to https://github.com/bitkeks/python-netflow-v9-softflowd. Copyright 2017-2019 <NAME> <<EMAIL>> Licensed under MIT License. See LICENSE. """ import logging import argparse import sys import socketserver import tim...
StarcoderdataPython
186811
from ray.rllib.agents.ppo.ppo import PPOTrainer, DEFAULT_CONFIG from ray.rllib.agents.ppo.appo import APPOTrainer __all__ = ["APPOTrainer", "PPOTrainer", "DEFAULT_CONFIG"]
StarcoderdataPython
172329
<reponame>rsalmaso/yawn from rest_framework import serializers from yawn.worker.models import Worker, Message, Queue class WorkerSerializer(serializers.ModelSerializer): class Meta: model = Worker fields = '__all__' class QueueSerializer(serializers.ModelSerializer): message_count = seriali...
StarcoderdataPython
1648643
<reponame>astsu-dev/pizza-store-backend<gh_stars>1-10 import uuid from typing import Optional, Protocol from pizza_store.db.models.user import User from sqlalchemy.ext.asyncio import AsyncSession class IUserCRUD(Protocol): """Has methods for getting, adding, deleting users from db.""" @classmethod def a...
StarcoderdataPython
1610501
<filename>giraf/filter.py from .enums import QueryType, GalleryType __all__ = ['Filter'] class FilterResult: def __init__(self): self.clear() def clear(self): self.failed = 0 self.matched = 0 self.total = 0 class Filter: def __init__(self, pages=1, max_results=None, query=None, query_type=None, ga...
StarcoderdataPython
1687696
<filename>service_layer/abstract_services/account_service.py from abc import ABC, abstractmethod from typing import List from entities.accounts import Account class AccountService(ABC): @abstractmethod def service_create_account(self, account: Account) -> Account: pass @abstractmethod def se...
StarcoderdataPython
3247695
<reponame>Jolumine/exp-trk<gh_stars>1-10 import json import os import hashlib def check_login(username, password) -> bool: path = f"C:\\Users\\{os.getlogin()}\\AppData\\local\\Expense_Tracker\\users" all = os.listdir(path) for i in all: file = path + f"\\{i}\\data.json" with open(f...
StarcoderdataPython
21404
import rospy from styx_msgs.msg import TrafficLight import numpy as np from keras.models import Model from keras import applications from keras.models import load_model from keras.preprocessing import image as img_preprocessing import cv2 # load the trained model from keras.utils.generic_utils import CustomObjectScop...
StarcoderdataPython
3366397
# # Copyright (c) 2015, Prometheus Research, LLC # import collections import json import yaml from six import text_type, add_metaclass __all__ = ( 'get_json', 'get_yaml', 'OrderedDict', 'SortedDict', 'TypedSortedDict', 'DefinedOrderDict', 'TypedDefinedOrderDict', 'InstrumentRefer...
StarcoderdataPython
99111
<gh_stars>0 import flask import unittest import browsepy import browsepy.manager as browsepy_manager import browsepy.plugin.player as player import browsepy.plugin.player.playable as player_playable class ManagerMock(object): def __init__(self): self.blueprints = [] self.mimetype_functions = []...
StarcoderdataPython
1768721
<gh_stars>10-100 __author__ = '<NAME> <<EMAIL>>' import re from unicon.plugins.nxos import NxosSingleRpConnectionProvider, NxosDualRpConnectionProvider from unicon.eal.dialogs import Dialog, Statement from unicon.plugins.nxos.utils import NxosUtils from unicon.plugins.generic.statements import more_prompt_handler fro...
StarcoderdataPython
3398914
<gh_stars>0 # Copyright (c) 2014 Eventbrite, Inc. All rights reserved. # See "LICENSE" file for license. from cs2mako.converter import Converter def test(): test_string = """a b c test 1.1: VAR ------------------------------------------------------------------------------ <?cs var:mg.foodata.foo ?>bar test ...
StarcoderdataPython
3355731
# this is the data access layer import json import uuid import UserDict import httplib import urllib from datetime import datetime import hashlib import pyes from werkzeug import generate_password_hash, check_password_hash from flaskext.login import UserMixin from bibserver.config import config import bibserver.util,...
StarcoderdataPython
132313
def config(args): """ This command configure eggs """ print("configure eggs")
StarcoderdataPython
4811351
N = int(input()) fac = range(1, N + 1) cnt = 1 for i in fac: cnt *= i print(cnt)
StarcoderdataPython
3257478
<reponame>aliharby12/Pastebin from rest_framework_simplejwt.serializers import TokenObtainPairSerializer,TokenRefreshSerializer from rest_framework_simplejwt.state import token_backend from rest_framework_simplejwt.tokens import RefreshToken from typing import Any,Dict from project.pastebin.models import User class M...
StarcoderdataPython
3272789
# test_some_blueprint.py import pytest from testing3.path.to.some_blueprint import bp @pytest.fixture def app_with_bp(dummy_app): dummy_app.blueprint(bp) return dummy_app @pytest.mark.parametrize( "input,expected_status", ( ( { "username": "Alice", ...
StarcoderdataPython
95724
<gh_stars>10-100 """ Circadia Sunrise Lamp - the lamp HAL hardware abstraction layer running on the lamp Author: fhu """ import json import pygame import time import neopixel import RPi.GPIO as gpio from MSR_HAL import povserial import MSR_OS.floatCanvas as fc # neopixels # LED strip configuration: LE...
StarcoderdataPython
1642905
<gh_stars>1000+ ''' Demonstrates how to sample and plot CIFAR10 images ''' from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import matplotlib.pyplot as plt import mnist_svhn_utils import math # load dataset data, _ = mnist_svhn_utils.load...
StarcoderdataPython
174286
<gh_stars>1-10 class Voice: def __init__( self, channel_id, user_id, session_id, deaf, mute, self_deaf, self_mute, self_video, suppress ): self.channel_id = channel_id self.user_id = user_id self.session_id =...
StarcoderdataPython
1683876
<gh_stars>100-1000 #!/usr/bin/env python3 import pygal x_time = [] out_octets = [] out_packets = [] in_octets = [] in_packets = [] with open('results.txt', 'r') as f: for line in f.readlines(): # eval(line) reads in each line as dictionary instead of string line = eval(line) x_time.append...
StarcoderdataPython
4821962
import os from os.path import join import astropy.io.fits as fits import astropy.units as u import astropy.coordinates as co from astropy.coordinates import SkyCoord import numpy as n import mangle import sys chunk = "eboss8" outputDir = join(os.environ['EBOSS_ROOT'],"target","elg","clusteringSample") outputCatalog =...
StarcoderdataPython
117287
<reponame>Pecneb/RaspberryPI import RPi.GPIO as gpio from gpio_init import LED, YELLOW, GREEN, TOUCH, BUZZER import time import led_sensor as led import buzzer_sensor as buzzer from notification import make_notif from event import Event def authenticate() -> bool: ''' user have 10 seconds to authenticate, ...
StarcoderdataPython
1641567
<gh_stars>0 time.mktime(datetime.datetime.strptime( str, '%a %b %d %H:%M:%S %z %Y').timetuple()) "Thu Mar 26 15:36:49 +0000 2020"
StarcoderdataPython
96485
<filename>luminoth/utils/test/gt_boxes.py import numpy as np def generate_gt_boxes(total_boxes, image_size, min_size=10, total_classes=None): """ Generate `total_boxes` fake (but consistent) ground-truth boxes for an image of size `image_size` (height, width). Args: total_boxes (int): The tot...
StarcoderdataPython
1718455
# coding: utf-8 from __future__ import unicode_literals import logging import numpy as np import pandas as pd from envs.fast_trading_env import FastTradingEnv logger = logging.getLogger(__name__) class Evaluator(object): def __init__(self, model_dir, input_shape): self._model_dir = model_dir s...
StarcoderdataPython
1654392
from collections import defaultdict class Graph: def __init__(self): self.graph = defaultdict(list) self.numNodes = None self.numEdges = None def buildGraph(self): self.numNodes = int(input("Number of nodes: ")) self.numEdges = int(input("Number ...
StarcoderdataPython
3265143
import os import unittest import cPickle as pickle from shutil import rmtree from tempfile import mkdtemp from mock import MagicMock, patch from swift.common.ring import RingBuilder from srm.ringminion import RingMinion from srm.utils import get_md5sum from swift.common import utils import urllib2 class MockResponse(o...
StarcoderdataPython
1626068
<gh_stars>0 from rx.internal import Enumerable from rx.internal import extensionclassmethod @extensionclassmethod(Enumerable) def while_do(cls, condition, source): def next(): while condition(source): yield source return Enumerable(next())
StarcoderdataPython
1689524
# Copyright 2020 The StackStorm Authors. # Copyright 2019 Extreme Networks, 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 # # Unless ...
StarcoderdataPython
1785665
# [381] O(1) 时间插入、删除和获取随机元素 - 允许重复 # https://leetcode-cn.com/problems/insert-delete-getrandom-o1-duplicates-allowed/description/ # * algorithms # * Hard (38.05%) # * Total Accepted: 6.8K # * Total Submissions: 16.2K # * Testcase Example: '["RandomizedCollection","insert","insert","insert","getRandom","remove","ge...
StarcoderdataPython
1699632
class Photo: def __init__(self, pk, orientation, tags): self.pk=pk self.is_vertical=orientation=='V' self.tags=tags
StarcoderdataPython
3393997
<gh_stars>100-1000 import os import os.path from dbManager import DbManager home = os.path.expanduser('~') if '.musicplayer' not in os.listdir(home): os.mkdir(os.path.join(home, '.musicplayer')) dbPath = os.path.join(home, '.musicplayer', 'userData.db') createTableString = """ CREATE TABLE IF NOT EXISTS playhi...
StarcoderdataPython
1645219
import random import math as m import pygame, random, sys from pygame.locals import * pygame.font.init() white=(255, 255, 255) green=(51, 255, 51) red=(255, 0, 0) yellow=(255, 255, 51) blue=(0, 0, 255) black=(0, 0, 0) pink=(255, 0, 255) xmin=0 xmax=1 ymin=0 ymax=1 radius=0.12 t=0 N=4 # No of har...
StarcoderdataPython
61696
import argparse import logging import sys import json from pprint import pprint from deepdiff import DeepDiff from mungetout import convert from mungetout import __version__ __author__ = "<NAME>" __copyright__ = "<NAME>" __license__ = "apache" _logger = logging.getLogger(__name__) def parse_args(args): """Par...
StarcoderdataPython
3275728
import os import random import wandb from datetime import datetime from utils.data_utils import * from utils.training_utils import train_GCN, train_Graph_Net, train_GAT, train_GraphSAGE from utils.parser import parser if __name__ == '__main__': data_path = './data/raw_data/' save_path = './trained_mod...
StarcoderdataPython
1628590
<reponame>numerodix/ansicolor<filename>docs/snippets/colored_diffs_1.py from ansicolor import Colors from ansicolor import colordiff statement = "All towles must be folded an stowed away neatly inthe closet." reviewed = "All towels must be folded and stowed neatly in the closet!" first, second = colordiff(statement, ...
StarcoderdataPython
3291884
<reponame>Islam-boussakaya/kloppy from .lineup import LineupStateBuilder from .score import ScoreStateBuilder from .sequence import SequenceStateBuilder from .formation import FormationStateBuilder
StarcoderdataPython
120673
<filename>main.py from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.gridlayout import GridLayout from kivy.properties import ObjectProperty, NumericProperty, ListProperty import bao_engine as Bao from kivy.logger import Logger from kivy.uix.image import Image from kivy.utils import get_col...
StarcoderdataPython
178546
<filename>_MOM/_DBW/_HPS/Pid_Manager.py # -*- coding: utf-8 -*- # Copyright (C) 2010-2015 Mag. <NAME> All rights reserved # Glasauergasse 32, A--1130 Wien, Austria. <EMAIL> # **************************************************************************** # This module is part of the package MOM.DBW.HPS. # # This module is...
StarcoderdataPython
1791551
# Copyright 2018 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
StarcoderdataPython
14382
import threading from queue import Queue from blessed import Terminal FPS = 60 class Game: """The top level class for the game""" def __init__(self, manager_cls: type): self.manager_cls = manager_cls def run(self) -> None: """The run method for the game, handling the TUI""" ter...
StarcoderdataPython
144954
<reponame>Limespy/limesqueezer<filename>src/limesqueezer/auxiliaries.py import numpy as np import math import sys import numba #%%═════════════════════════════════════════════════════════════════════ # AUXILIARIES def to_ndarray(item, shape = ()) : if not hasattr(item, '__iter__'): # Not some iterable if -1...
StarcoderdataPython
3300509
<filename>tencent_finance/unicode_converter.py #!/usr/bin/env python # -*- coding:utf-8 -*- def to_utf8_string(unicodestr): utf8str = '' start = 0 end = 0 pos = unicodestr.find('\\u') while pos != -1: end = pos if start != end: utf8str += unicodestr[start:end] s...
StarcoderdataPython
3345672
<reponame>MIPS/external-chromium_org<gh_stars>1-10 # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """The tab switching measurement. This measurement opens pages in different tabs. After all the tabs have...
StarcoderdataPython
180239
<reponame>janvanrijn/feature-encoding import argparse import feature_encoding import logging import numpy as np import openml import os import pandas as pd import sklearnbot def parse_args(): parser = argparse.ArgumentParser() all_classifiers = sklearnbot.config_spaces.get_available_config_spaces(True) pa...
StarcoderdataPython
4830784
# Copyright 1999-2020 Alibaba Group Holding 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 a...
StarcoderdataPython
38449
<filename>main/cogs/commands.py from types import SimpleNamespace class Names(SimpleNamespace): def __init__(self, dictionary, **kwargs): super().__init__(**kwargs) for key, value in dictionary.items(): if isinstance(value, dict): self.__setattr__(key, Names(value)) ...
StarcoderdataPython
61596
from database.imports import * from database.models.base import Base from database.models.mixins import HasNotes, HasMetaData, HasCiteables, HasTreeStructure, HasExperiments, HasProperties ###----------------------------------- ### Hardware inventory, aka rig parts ###----------------------------------- class Hardw...
StarcoderdataPython
3355618
<gh_stars>10-100 from django.conf import settings from django.http import HttpResponseRedirect, HttpResponse from django.db.models import Model from django.contrib.contenttypes.models import ContentType from django.contrib.auth import authenticate from django.template import TemplateDoesNotExist, RequestContext, loader...
StarcoderdataPython
1614587
#!/usr/bin/env python """ Displaying large NumPy arrays with TabularEditor A demonstration of how the TabularEditor can be used to display (large) NumPy arrays, in this case 100,000 random 3D points from a unit cube. In addition to showing the coordinates of each point, it also displays the index of each point in th...
StarcoderdataPython
3246359
import torch import torch.nn as nn import torch.nn.functional as F class hsigmoid(nn.Module): def forward(self, x): out = F.relu6(x + 3, inplace=True) / 6 return out class AttentionWeights(nn.Module): def __init__(self, num_channels, k, attention_mode=0): super(AttentionWeights, self...
StarcoderdataPython
2709
import logging import groceries.api as groceries import barcodescanner.scan as barcode def main(): grocy = groceries.GrocyAPIClient() while True: scanner = barcode.Scan() line = scanner.PollScanner() if line != None: response = grocy.consume_barcode(line) loggin...
StarcoderdataPython
3244374
<reponame>open-discourse/open-discourse import od_lib.definitions.path_definitions as path_definitions import xml.etree.ElementTree as et import os import regex # input directory ELECTORAL_TERM_19_INPUT = path_definitions.ELECTORAL_TERM_19_STAGE_01 # output directory ELECTORAL_TERM_19_OUTPUT = path_definitions.ELECTO...
StarcoderdataPython
1720645
<gh_stars>1-10 class PsAdjustmentReference : psRelative = 1 psAbsolute = 2 class PsAnchorPosition : psTopLeft = 1 psTopCenter = 2 psTopRight = 3 psMiddleLeft = 4 psMiddleCenter = 5 psMiddleRight = 6 psBottomLeft = 7 psBottomCenter = 8 psBottomRight = 9 clas...
StarcoderdataPython
3283648
<filename>py/garage/garage/http/policies.py """HTTP client policy objects.""" __all__ = [ # Rate limit policy 'Unlimited', 'TokenBucket', # Retry policy 'NoRetry', 'BinaryExponentialBackoff', ] import random import threading import time class Unlimited: def __enter__(self): pass...
StarcoderdataPython
3320319
<reponame>jhalljhall/forest import pandas as pd from forest.willow.log_stats import comm_logs_summaries ID = "6b38vskd" STAMP_START = 1453837206 STAMP_END = 1454634000 TZ_STR = "America/New_York" OPTION = "daily" def test_comm_log_summaries_with_empty_data(): text_data = pd.DataFrame.from_dict({}) call_data...
StarcoderdataPython
1665451
<gh_stars>1-10 import consloadingbar, time time.sleep(0.1) print(end='\r') clb = consloadingbar.Bar(title='ProgressBar 1', taskCount=10, useColor=True) for i in range(101): clb.progressBar(i, tasksDone=i//10) time.sleep(0.02) time.sleep(0.1) print() clb = consloadingbar.Bar(title='ProgressBar 2', mainBarChar...
StarcoderdataPython
4812530
<reponame>leonardodalinky/pywmapi from .defs import * from .functions import *
StarcoderdataPython
4822393
import numpy as np import h5py def scaler(x, min_val, max_val, lower_norm_val, upper_norm_val): """Scale the signal between a min and max value Parameters =========== x : ndarray Signal that is being normalized max_val : int or float Maximum value of the signal or dataset ...
StarcoderdataPython
64631
#! /usr/env/bin python import os import linecache import multiprocessing import numpy as np from collections import OrderedDict from CP2K_kit.tools import call from CP2K_kit.tools import log_info from CP2K_kit.tools import data_op from CP2K_kit.tools import traj_info from CP2K_kit.tools import file_tools from CP2K_kit...
StarcoderdataPython
3306320
import asyncio from random import random from typing import Callable, Type, List from httpx import AsyncClient from nanoid import generate from retrying import retry from .fitting_state import Fitting_State from ...fso import FSO class Async_Fitting: def __init__(self): self.state:Type[Fitting_State] = ...
StarcoderdataPython
3324871
#!/usr/bin/env python # -*- coding:utf-8 -*- # @Author: <NAME> # @Date: Friday, July 5th 2019, 11:46:37 am from ibllib.io.flags import FLAG_FILE_NAMES
StarcoderdataPython
1670855
import unittest from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.desired_capabilities import DesiredCapabilities import time class AutolabTests(unittest.TestCase): def setUp(self): self.test_url = "http://autolab.cs.cmu.edu/auth/users/sig...
StarcoderdataPython
102620
<reponame>jflatorreg/scikit-maad # -*- coding: utf-8 -*- """ Created on Mon Aug 6 17:59:44 2018 This script gives an example of how to use scikit-MAAD for ecoacoustics indices """ # # Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # License: New BSD License print(__doc__) # Clear all the va...
StarcoderdataPython
1773044
import random # vytvoření seznamu alist = ['a', 12, None, print] print(alist) # průchod prvky seznamu for item in alist: print(item) # k seznamům lze přistupovat jako k řetězcům print(alist[2]) print(alist[-1]) print(alist[1:-1]) print(type(alist[1:-1])) # Při přiřazení jednoho seznamu do druhého nedochází ke k...
StarcoderdataPython
3212937
<filename>src/loginOS.py import json import requests def login_os(data, url): username = data['user'] password = data['password'] params = {'userName': username, 'password': password} proxies = {'http': None, 'https': None} url_login = url + "login-sessions" response = requests.post(url_login...
StarcoderdataPython
1757021
import random import sys import os import dill import argparse import pandas as pd import numpy as np from tqdm import tqdm import itertools import torch #from .kalman_filter import NonlinearKinematicBicycle # sys.path.append("/home/adeshkin/Desktop/shifts/sdc") from ysdc_dataset_api.utils import get_file_paths, scen...
StarcoderdataPython
43570
<filename>google/cloud/monitoring_v3/types/dropped_labels.py # -*- 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...
StarcoderdataPython
3367985
from .start import start start()
StarcoderdataPython
3300869
<reponame>TatyanaPolunina/Advanced_Lane_Recognition import numpy as np import cv2 import matplotlib.pyplot as plt def filter_by_threshold(binary, threshold): sxbinary = np.zeros_like(binary) sxbinary[(binary >= threshold[0]) & (binary <= threshold[1])] = 1 return sxbinary def get_sobel_binary(image, thre...
StarcoderdataPython
165107
<gh_stars>0 import pickle dogs_dict = {'Ozzy': 3, 'Filou': 8, 'Luna': 5, 'Skippy': 10, 'Barco': 12, 'Balou': 9, 'Laika': 16} print(dogs_dict) filename = 'dogs' outfile = open(filename, 'wb') pickle.dump(dogs_dict, outfile) outfile.close()
StarcoderdataPython
3279855
<reponame>PauloRadatz/py_dss_interface # -*- encoding: utf-8 -*- """ Created by eniocc at 11/10/2020 """ from py_dss_interface.models import Bridge from py_dss_interface.models.Base import Base from py_dss_interface.models.Loads.LoadsS import LoadsS from py_dss_interface.models.Text.Text import Text class LoadsV(Ba...
StarcoderdataPython
1738765
import six import os from st2actions.runners.pythonrunner import Action from st2client.client import Client from st2common.util import jinja as jinja_utils class FormatResultAction(Action): def __init__(self, config=None, action_service=None): super(FormatResultAction, self).__init__(config=config, actio...
StarcoderdataPython
1670521
# -*- coding: UTF8 -*- #Author: @bobsecq #Contributor(s): from pupylib.utils.term import colorize import subprocess try: import ConfigParser as configparser except ImportError: import configparser class rubber_ducky(): ''' ''' TARGET_OS_MANAGED = ['Windows'] ENCODE_CMD = "java -jar {0} -i {1...
StarcoderdataPython
1650705
import tensorflow as tf from .abc_models import classification_model from tensorflow.contrib.slim.nets import inception slim = tf.contrib.slim class inception_v1_model(classification_model): def __init__(self, hyparams): classification_model.__init__(self, hyparams) self._name = 'inception_v1_mod...
StarcoderdataPython
4834323
#!/usr/bin/python import os import time import tensorflow as tf from tensorflow import flags from tensorflow import gfile from tensorflow import logging import readers import utils import numpy as np FLAGS = flags.FLAGS flags.DEFINE_string("feature_names", "rgb", "Name of the feature " "to use for training.") flags....
StarcoderdataPython
1621158
<gh_stars>0 #from package1 import * #from package1.package11 import * from package1.package11 import * #from package1.package11.module1 import * #from package1.package11 import module2 print(dir()) #print(dir('pakage11')) #some_method() module2.some_method() #package11.module2.some_method() #package1.package11.modul...
StarcoderdataPython
131972
<gh_stars>0 # if train_or_eval = True then 训练 else 测试 train_or_eval = False # train_or_eval = True if train_or_eval is not True: # 测试的配置 task = 'denoising' dataset_dir = r'/user51/mxy/data/J4R/frames_heavy_test_JPEG' # 测试图片包括边缘图的路径 dataset_gtc_dir = r'/user51/mxy/data/J4R/frames_heavy_test_JPE...
StarcoderdataPython
44846
import cv2 ''' gets a video file and dumps each frame as a jpg picture in an output dir ''' # Opens the Video file cap = cv2.VideoCapture('./Subt_2.mp4') i = 0 while(cap.isOpened()): ret, frame = cap.read() if i%(round(25*0.3)) == 0: print(i) if ret == False: break...
StarcoderdataPython
1703138
<filename>src/peeringdb/_sync.py """ Sync implementation module """ import datetime from collections import defaultdict from peeringdb.util import group_fields def _field_resource(B, concrete, field): return B.get_resource(B.get_field_concrete(concrete, field)) def clean_helper(B, obj, clean_func): """ ...
StarcoderdataPython
4832599
<gh_stars>1-10 # -*- coding: utf-8 -*- # # Accessibility documentation build configuration file, created by # sphinx-quickstart on Wed Jan 8 19:26:38 2014. import os import sys sys.path.append(os.path.abspath('theme')) # -- General configuration ----------------------------------------------------- extensions = ['s...
StarcoderdataPython
4810396
import abc class oveja(): @abc.abstractmethod def clone(self): pass class dolly(oveja): def __init__(self,nombre,tipo): self.nombre=nombre self.tipo=tipo def set_nombre(self,nombre): self.nombre=nombre def set_tipo(self,tipo): self.tipo=tipo def get_tipo(self): return self.tipo def get_nombre(self):...
StarcoderdataPython
4808316
<reponame>fnRaihanKibria/OpenAssetIO<filename>python/openassetio/test/specifications.py # # Copyright 2022 The Foundry Visionmongers 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 a...
StarcoderdataPython
1689221
<reponame>justinsousa/integrations-core # (C) Datadog, Inc. 2018 # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) GAUGES = [ 'tokumx.connections.available', 'tokumx.connections.current', 'tokumx.cursors.timedOut', 'tokumx.cursors.totalOpen', 'tokumx.ft.alerts.check...
StarcoderdataPython
3231843
# Problem: https://www.hackerrank.com/challenges/compress-the-string/problem # Score: 20 from itertools import groupby print(*[(len(list(c)), int(x)) for x, c in groupby(input())])
StarcoderdataPython
4812278
from django.urls import path,re_path from backend import views
StarcoderdataPython
79660
import torch import matplotlib.pyplot as plt from torchvision import datasets, transforms from random import choice BATCH_SIZE=64 # Load the mnist dataset train_loader = torch.utils.data.DataLoader( datasets.MNIST( "./data", train=True, download=True, transform...
StarcoderdataPython
3356946
#!/usr/bin/env python # -*- coding: utf-8 -*- # Convert FEATURES with trained models. # By <NAME> 2019.06 import json import os import tensorflow as tf import numpy as np from importlib import import_module import argparse import logging import sys from preprocessing.vcc2018.feature_reader import Whole_feature_re...
StarcoderdataPython
1619371
<filename>snafu/__main__.py import click class SnafuGroup(click.Group): """Force command name to 'snafu'. """ def make_context(self, info_name, *args, **kwargs): return super().make_context('snafu', *args, **kwargs) @click.group(cls=SnafuGroup, invoke_without_command=True) @click.option('--versi...
StarcoderdataPython