id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3383001
<gh_stars>0 import pandas as pd from tqdm import tqdm tqdm.pandas() # Load concat file SRS df = pd.read_csv("/gstock/biolo_datasets/ENCODE/ENCODE_SRS_concat.tsv.gz", compression="gzip", sep="\t") # Process files df[["ENST", "ENSG", "VEGAT", "VEGAG", "transcript_id", "GeneID", "transcript_length", "transcript_biotype...
StarcoderdataPython
3369331
<gh_stars>10-100 import logging from abc import ABC, abstractmethod from typing import Optional, Dict import copy import pandas as pd import xarray as xr from pywatts.core.computation_mode import ComputationMode from pywatts.core.filemanager import FileManager from pywatts.core.run_setting import RunSetting from pywa...
StarcoderdataPython
1660973
from astrodash.preprocessing import ReadSpectrumFile from astrodash.helpers import temp_list import pickle import os import gzip class SaveTemplateSpectra(object): def __init__(self, parameterFile): with open(parameterFile, 'rb') as f: pars = pickle.load(f) self.w0, self.w1, self.n...
StarcoderdataPython
30954
<filename>test/test_commands/test_tail.py<gh_stars>10-100 from pypsi.shell import Shell from pypsi.commands.tail import TailCommand class CmdShell(Shell): tail = TailCommand() class TestTail: def setup(self): self.shell = CmdShell() def teardown(self): self.shell.restore()
StarcoderdataPython
4819445
<reponame>TheTrafficNetwork/Automation """ Takes a list of devices from NetBox with a LibreNMS tag and checks to see if they are programmed in LibreNMS. If they are missing, they are then added. """ import json import os import pynetbox import requests from dotenv import find_dotenv, load_dotenv from sty import fg f...
StarcoderdataPython
56224
<reponame>youlei202/tensorforce-lei<filename>tensorforce/execution/runner.py # Copyright 2017 reinforce.io. 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:/...
StarcoderdataPython
100864
<reponame>EfficientDL/codelab_utils import setuptools with open('README.md', 'r', encoding='utf-8') as fh: long_description = fh.read() setuptools.setup( name='codelab_utils', version='0.2', author='Efficient Deep Learning Book', author_email='<EMAIL>', description='Some util methods related t...
StarcoderdataPython
136748
import os import random import pathlib import shutil import glob import cv2 import numpy as np def load_name_images(image_path_pattern): name_images = [] # 지정한 Path Pattern에 일치하는 파일 얻기 image_paths = glob.glob(image_path_pattern) # 파일별로 읽기 for image_path in image_paths: path = pathlib.Path(i...
StarcoderdataPython
30752
import re import operator from collections import namedtuple SCHEMA_TYPES = {'str', 'int', 'bool'} ROWID_KEY = '_rowid' class Literal(namedtuple('Literal', 'value')): @classmethod def eval_value(cls, value): if not isinstance(value, str): raise ValueError(f"Parameter {value} must be a str...
StarcoderdataPython
4825662
<reponame>sherlockliu/pythonic import pytest @pytest.fixture(scope="function") def before_1(): print('\nbefore each test') def test_1(before_1): print('test_1()') def test_2(before_1): print('test_2()')
StarcoderdataPython
198486
<reponame>robertwenquan/nyu-course-assignment<filename>design-and-analysi-of-algorithms/class5/quick-sort.py #!/usr/bin/python import random __author__ = 'Wen' def partition(AA, start, end): pivot = random.randint(start, end) AA[start], AA[pivot] = AA[pivot], AA[start] pivot = start pointA = start+...
StarcoderdataPython
1781608
<gh_stars>0 from contextlib import contextmanager from functools import wraps from io import TextIOWrapper import djclick as click from django.utils import timezone def show_command_time(fn): @wraps(fn) def wrapper(*args, **kwargs): start_time = timezone.now() result = fn(*args, **kwargs) ...
StarcoderdataPython
1705328
from xml.sax.saxutils import escape class Node: def __init__(self, start, end, tag, parent, attrs): self.start = start self.end = end self.tag = tag self.parent = parent self.children = [] if attrs: self.attrs = attrs else: self...
StarcoderdataPython
3208008
<reponame>muhammadrazaali-RAZA/AI---Snake-Game import random from display import display_base from itertools import product class Apple(display_base): def __init__(self, **kwargs): super().__init__(**kwargs) self.location = None def refresh(self, snake): """ ...
StarcoderdataPython
1613583
<reponame>kattni/Adafruit_CircuitPython_seesaw<filename>examples/seesaw_analogin_test.py # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT # Simple seesaw test reading analog value # on SAMD09, analog in can be pins 2, 3, or 4 # on Attiny8x7, analog in can be pins 0, 1, 2, 3...
StarcoderdataPython
3217328
<reponame>common-config-bot/prjuray #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020-2022 F4PGA Authors # # 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.apa...
StarcoderdataPython
4807683
# -*- coding: utf-8 -*- # @File : tryEverything/beam_search.py # @Info : @ TSMC-SIGGRAPH, 2018/6/19 # @Desc : refer to google/im2txt # -.-.. - ... -- -.-. .-.. .- -... .---. -.-- ..- .-.. --- -. --. ..-. .- -. import heapq import math import numpy as np class Caption(object): """Represents a compl...
StarcoderdataPython
1664809
<filename>d3m/primitive_interfaces/distance.py import abc import typing from d3m import types from d3m.primitive_interfaces.base import * from d3m.primitive_interfaces.transformer import TransformerPrimitiveBase __all__ = ('PairwiseDistanceLearnerPrimitiveBase', 'PairwiseDistanceTransformerPrimitiveBase', 'InputLabel...
StarcoderdataPython
3322704
import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from sklearn import datasets class AdalineGD(object): def __init__(self, eta=0.01, n_iter=50): self.eta = eta self.n_iter = n_iter def fit(self, x, y): self.w_ = np.zeros(1 + x.shape[1]) ...
StarcoderdataPython
3343980
from Instrucciones.TablaSimbolos.Instruccion import Instruccion from Instrucciones.Excepcion import Excepcion import numpy as np class Min(Instruccion): def __init__(self, valor, tipo, strGram, linea, columna): Instruccion.__init__(self,tipo,linea,columna, strGram) self.valor = valor def ejecu...
StarcoderdataPython
25886
<reponame>gwtnb/jubatus-python-client<filename>test/jubatus_test/classifier/test.py #!/usr/bin/env python import unittest import json import msgpackrpc from jubatus.classifier.client import Classifier from jubatus.classifier.types import * from jubatus_test.test_util import TestUtil from jubatus.common import Datum ...
StarcoderdataPython
3292356
<reponame>Instagram/LibCST<filename>libcst/_typed_visitor.py # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # This file was generated by libcst.codegen.gen_matcher_classes from typing im...
StarcoderdataPython
3211806
""" Module about Pauli (and I) matrices. """ import numpy as np from numpy import zeros_like from scipy.linalg import svd s0 = np.array([[1, 0], [0, 1]]) s1 = np.array([[0, 1], [1, 0]]) s2 = np.array([[0, -1j], [1j, 0]]) s3 = np.array([[1, 0], [0, -1]]) s0T = s0.T s1T = s1.T s2T = s2.T s3T = s3.T pauli_dict = {0: s...
StarcoderdataPython
3350469
# -*- coding:utf-8 -*- # Created Time: 2018/03/12 10:48:38 # Author: <NAME> <<EMAIL>> from dataset import config, MultiCelebADataset from nets import Encoder, Decoder, Discriminator import os import argparse import torch from torchvision import transforms from PIL import Image import numpy as np from tensorboardX imp...
StarcoderdataPython
3214586
<gh_stars>1-10 #!/usr/bin/env python3 # Copyright 2020, <NAME> # Licensed under the terms of the MIT license. See LICENSE file in project root for terms. # Ensure the device is at the "Enter PIN:" prompt from serial_port_util import CTFSerial import sys if len(sys.argv) < 2: print("Usage: {} serport".format(sys...
StarcoderdataPython
1719283
from beam import ViewSet from beam.contrib.autocomplete_light import AutocompleteMixin from beam.registry import RegistryType from django.core.exceptions import PermissionDenied from django.test import RequestFactory, TestCase from test_views import user_with_perms from testapp.models import Dragonfly registry: Regist...
StarcoderdataPython
3344570
"""Add address fields to user Revision ID: 4d1a5fb71db Revises: <PASSWORD> Create Date: 2015-10-10 16:56:57.670618 """ # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '<PASSWORD>' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql def upgrade(): ###...
StarcoderdataPython
1757448
#!/usr/bin/env python3 import curses import curses.textpad import threading import time import textwrap import collections import logging class HCHandler(logging.Handler): def __init__(self, con): super().__init__() self.con = con self.setFormatter(logging.Formatter(fmt="{levelname}:{name}:{message}", style="{"...
StarcoderdataPython
3286392
from random import randint n, k, c = map(int, input().split()) s = input() cur = 0 workday = 0 worked_left = set() while cur < n: if s[cur] == "o": workday += 1 worked_left.add(cur + 1) cur += c + 1 else: cur += 1 if workday == k: break else: exit() cur = n ...
StarcoderdataPython
74498
<filename>App/fbpage.py # coding: utf-8 import os parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) os.sys.path.insert(0,parentdir) from fbmq import Page from config import CONFIG page = Page(CONFIG['FACEBOOK_TOKEN']) @page.after_send def after_send(payload, response): print('AFTER_SEND : ...
StarcoderdataPython
1736353
<filename>ex072_tuplas_num_por_extenso.py extenso = 'zero', 'um', 'dois', 'três', 'quatro', 'cinco', 'seis', 'sete',\ 'oito', 'nove', 'dez', 'onze', 'doze', 'treze', 'catorze', 'quinze',\ 'dezesseis', 'dezessete', 'dezoito', 'dezenove', 'vinte' for num in range(0, len(extenso)): num = int(input(...
StarcoderdataPython
1772819
from PyQt5.QtSerialPort import QSerialPort, QSerialPortInfo from PyQt5.QtCore import QThread import pyttsx3 import voice voice = voice.voice sensors = [] for i in range(15): sensors.append('') class SerialReadThread(QThread): def __init__(self, mainwindow, serial, parent=None): super().__i...
StarcoderdataPython
1742036
# SPDX-License-Identifier: Apache-2.0 # Copyright 2019 Blue Cheetah Analog Design 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 # # U...
StarcoderdataPython
1788950
<filename>libtaxii/taxii_default_query.py # Copyright (c) 2017, The MITRE Corporation # For license information, see the LICENSE.txt file """ Creating, handling, and parsing TAXII Default Queries. """ import numbers import datetime from operator import attrgetter import os import dateutil.parser from lxml import et...
StarcoderdataPython
79913
<reponame>Miguel-J/pineboo-buscar<filename>pineboolib/kugar/mreportdetail.py from pineboolib import decorators from pineboolib.flcontrols import ProjectClass from pineboolib.kugar.mreportsection import MReportSection class MReportDetail(ProjectClass, MReportSection): @decorators.BetaImplementation def __ini...
StarcoderdataPython
3280089
<reponame>wk8/elle<gh_stars>100-1000 # Copyright (C) 2013-2016, Quentin "mefyl" Hocquet # # This software is provided "as is" without warranty of any kind, # either expressed or implied, including but not limited to the # implied warranties of fitness for a particular purpose. # # See the LICENSE file for more informat...
StarcoderdataPython
87984
<gh_stars>0 from paa191t1.dijkstra.datastructs.vector import Vector from paa191t1.tests.dijkstra.datastructs.test_dijkstra_structs import TestStructsBase class TestStructsVector(TestStructsBase): struct = Vector()
StarcoderdataPython
3276388
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from ... import units as u from ..distances import Distance from .. import transformations as t from ...
StarcoderdataPython
36135
<reponame>Omar-Gonzalez/echangarro-demo # Generated by Django 2.2.2 on 2020-03-07 03:59 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('ordenes', '0002_auto_20200305_0056'), ] operations = [ migrations.AddField( model_name='...
StarcoderdataPython
1657828
<filename>env/lib/python3.6/site-packages/tqdm/_tqdm_pandas.py import sys __author__ = "github.com/casperdcl" __all__ = ['tqdm_pandas'] def tqdm_pandas(tclass, *targs, **tkwargs): """ Registers the given `tqdm` instance with `pandas.core.groupby.DataFrameGroupBy.progress_apply`. It will even close() ...
StarcoderdataPython
1708275
#!/usr/bin/env python # -*- coding:utf-8 -*- # TextFilterResult.py # 2021, <NAME>, https://github.com/toolgood/ToolGood.TextFilter.Api # MIT Licensed __all__ = ['ToolGood.TextFilter.TextFilterResult'] class TextFilterResult(): '返回码:0) 成功,1) 失败' code=0 '返回码详情描述' message="" '请求标识' requestId=0 ...
StarcoderdataPython
1651297
<reponame>JamesDownsLab/AdventOfCode2019<filename>Day6/day6code.py # Universal Orbit Map # Whenever A orbits B and B orbits C, then A INDIRECTLY ORBITS C with open('input.txt', 'r') as f: test_input = f.read() test_input = test_input.split('\n')[:-1] class orbiter: def __init__(self, id, parent): sel...
StarcoderdataPython
3289591
_base_ = "./ss_mlBCE_MaskFull_PredDouble_PBR05_woCenter_edgeLower_refinePM10_01_02MasterChefCan.py" OUTPUT_DIR = "output/self6dpp/ssYCBV/ss_mlBCE_MaskFull_PredDouble_PBR05_woCenter_edgeLower_refinePM10/15_35PowerDrill" DATASETS = dict( TRAIN=("ycbv_035_power_drill_train_real_aligned_Kuw",), TRAIN2=("ycbv_035_po...
StarcoderdataPython
1606199
<gh_stars>0 import os from scalesim.scale_config import scale_config from scalesim.topology_utils import topologies from scalesim.simulator import simulator as sim class scalesim: def __init__(self, save_disk_space=False, verbose=True, config='', ...
StarcoderdataPython
1731273
<reponame>lipovsek/oslo<filename>oslo/torch/nn/parallel/pipeline_parallel/__init__.py from oslo.torch.nn.parallel.pipeline_parallel.pipeline_parallel import ( PipelineParallel, ) __ALL__ = [PipelineParallel]
StarcoderdataPython
1750102
<reponame>rahulremanan/HIMA import os import sys import random import warnings import types import time import gc import numpy as np import pandas as pd import matplotlib.pyplot as plt from tqdm import tqdm from itertools import chain from skimage.io import imread, imshow, imread_collection, concatenate_images from ...
StarcoderdataPython
1653113
#!/usr/bin/env python from flask import Flask, render_template, Response import cv2 import sys import numpy app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') def get_frame(): camera_port=0 camera=cv2.VideoCapture(camera_port) #this makes a web cam object while T...
StarcoderdataPython
3264149
# Copyright 2021 Zuva 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 required by applicable law or agreed to in writing, softwa...
StarcoderdataPython
3289945
<gh_stars>1-10 # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @return a ListNode def insertionSortList(self, head): if not head: return head dummy =...
StarcoderdataPython
1780035
<gh_stars>1-10 from .coco_evaluator import COCOEvaluator from .voc_evaluator import VOCEvaluator
StarcoderdataPython
3281575
def is_even(n): return n % 2 == 0 def test_product_of_even_numbers_is_even(): "Natural numbers truths" evens = [(18, 8), (14, 12), (0, 4), (6, 2), (16, 10)] for e1, e2 in evens: check_even.description = "for even numbers %d and %d their product is even as well" % (e1, e2) yield check_e...
StarcoderdataPython
1763779
from django.conf.urls import * from django.contrib import admin import AuShadha.settings from patient.views import * from patient.dijit_widgets.pane import render_patient_pane from patient.dijit_widgets.tree import render_patient_tree admin.autodiscover() urlpatterns = patterns('', ################################ ...
StarcoderdataPython
3295251
<filename>src/config.py<gh_stars>0 from transformers import (BertConfig, RobertaConfig, XLNetConfig, AlbertConfig, LongformerConfig, BertTokenizer, RobertaTokenizer, XLNetTokenizer, AlbertTokenizer, LongformerTokenizer, DebertaConfig, DebertaTokenizer, ElectraConfig, ...
StarcoderdataPython
41729
# -*- coding: utf-8 -*- """ Created on Sun Feb 7 13:43:01 2016 @author: fergal A series of metrics to quantify the noise in a lightcurve: Includes: x sgCdpp x Marshall's noise estimate o An FT based estimate of 6 hour artifact strength. o A per thruster firing estimate of 6 hour artifact strength. $Id$ $URL$ """ ...
StarcoderdataPython
1618498
# -*- coding: utf-8 -*- """ シミュレーション制御モジュール """ # python lib import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm import time import multiprocessing as mp # utils from controllers.sml.model import * from controllers.sml.extension.visualization.canvas_grid_visualization_extension import CanvasGr...
StarcoderdataPython
3204305
<reponame>JustinTStanley/docdb-rest<gh_stars>1-10 """ Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at http:/...
StarcoderdataPython
119695
import os from glob import glob import subprocess import sys import pathlib import json import yaml import nbformat import nbterm import traceback import asyncio import config import click def get_toc_files(notebooks_only=True): """return a list of files in the _toc.yml""" with open("_toc.yml") as fid: ...
StarcoderdataPython
3323709
<filename>Libraries/Python/CommonEnvironment/v1.0/CommonEnvironment/TypeInfo/ClassTypeInfo.py # ---------------------------------------------------------------------- # | # | ClassTypeInfo.py # | # | <NAME> <<EMAIL>> # | 2016-09-04 20:29:59 # | # -----------------------------------------------------...
StarcoderdataPython
184880
class Pizza: def __init__(self, name, dough, toppings_capacity): self.__name = name self.__dough = dough self.__toppings_capacity = toppings_capacity self.__toppings = {} @property def name(self): return self.__name @name.setter def name(self, new_name): ...
StarcoderdataPython
3300500
class Card: def __init__(self, rank, suit): self.rank = rank self.suit = suit self.gameRank = 0
StarcoderdataPython
3324270
<reponame>thanhndv212/pinocchio import pinocchio as pin import numpy as np from os.path import * # Goal: Build a reduced model from an existing URDF model by fixing the desired joints at a specified position. # Load UR robot arm # This path refers to Pinocchio source code but you can define your own directory here. ...
StarcoderdataPython
97882
def intersection(right=[], left=[]): return list(set(right).intersection(set(left))) def union(right=[], left=[]): return list(set(right).union(set(left))) def union(right=[], left=[]): return list(set(right).difference(set(left))) # not have in left
StarcoderdataPython
7049
import pathlib print(pathlib.Path(__file__).parent.resolve()) while True: next_cmd = input("> ") print(eval(next_cmd))
StarcoderdataPython
1661088
<filename>Flask_01/news/comments.py from . import comments_bp @comments_bp.route('/comments') def comments_project(): return 'comments_project'
StarcoderdataPython
1710986
# -*- coding: utf-8 -*- # # Copyright (C) 2021 GEO Secretariat. # # geo-knowledge-hub is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see LICENSE file for more # details. """GEO Knowledge Hub Identifiers helpers.""" import idutils import posixpath from pydash import p...
StarcoderdataPython
3282340
"""The regular expressions to be used in various modules.""" import re CELL_START_PATTERN = re.compile(r"^\s{0,5}\d+\s+0") """Line starts with number followed with 0.""" CELLS_END_PATTERN = re.compile(r"^\s*$") """Empty line. Separates sections in MCNP file. """ MATERIAL_PATTERN = re.compile(r"^\s{0,4}[mM](?P<mate...
StarcoderdataPython
1799127
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. import torch import torch.nn as nn import numpy as np def gen_non_linearity(A, non_linearity): ''' Returns required activation for a tensor based on the inputs non_linearity is either a callable or a value in ...
StarcoderdataPython
1699696
<filename>backend/apps/acl/urls.py<gh_stars>1-10 from backend.util.utils import url_join class CommonUrlDispatcher(object): BASE_CONFIG_URL = '/restconf/config/network-topology:network-topology/topology/topology-netconf/node/{}/yang-ext:mount' GET_INTERFACES_URL = url_join(BASE_CONFIG_URL, '/Cisco-IOS-XR-ifm...
StarcoderdataPython
30889
<filename>zhaquirks/xiaomi/aqara/plug.py """Xiaomi lumi.plug plug.""" import logging from zigpy.profiles import zha from zigpy.zcl.clusters.general import ( AnalogInput, Basic, BinaryOutput, DeviceTemperature, Groups, Identify, OnOff, Ota, PowerConfiguration, Scenes, Time, )...
StarcoderdataPython
3253410
import os from datetime import date, datetime from aiogram import Bot, types from aiogram import Dispatcher from aiogram.types.message import ContentType from aiogram.utils import executor import dotenv from utils_db import (check_have_member, check_active, create_roll, create_user, activated_user, ...
StarcoderdataPython
30790
from pulp import * prob = LpProblem("PULPTEST", LpMinimize) # model variables XCOORD = [0, 1, 2] YCOORD = [0, 1, 2] NUMBERS = [1, 2, 3, 4, 5, 6, 7, 8, 9] # variable is a 3 x 3 x 9 matrix of binary values allocation = LpVariable.dicts("square", (XCOORD, YCOORD, NUMBERS), 0, 1, LpInteger) # target function prob += 0...
StarcoderdataPython
1650035
<gh_stars>0 from eth_account import Account import secrets def create_account(): priv = secrets.token_hex(32) private_key = "0x" + priv print("Game specific private key... this is for an optional wallet for you not to worry on exposing your assets from other wallets\n") print(f"pk: {private_key}") ...
StarcoderdataPython
3366753
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys if __name__ == '__main__': a = int(input("a = ")) if a == 1: print("Январь") elif a == 2: print("февраль") elif a == 3: print("Март") elif a == 4: print("Апрель") elif a == 5: print(...
StarcoderdataPython
1630242
import unittest def next_permutation(arr): i = len(arr) - 1 while i > 0 and arr[i - 1] >= arr[i]: i -= 1 if i <= 0: return False j = len(arr) - 1 while arr[j] <= arr[i - 1]: j -= 1 arr[i - 1], arr[j] = arr[j], arr[i - 1] arr[i:] = arr[len(arr) - 1 : i - 1 : -1] ...
StarcoderdataPython
79695
#!/usr/bin/env python3 # Copyright (C) 2020-2020 <NAME>. All rights reserved. # # This file is subject to the terms and conditions defined in file 'LICENSE', # which is part of this source code package. from typing import Optional import aioserial import asyncio import click import functools from perso import PTE, ...
StarcoderdataPython
199588
""" coding: utf-8 Created on 30/10/2020 @author: github.com/edrmonteiro From: Codility Lessons """ # DivCount # Write a function: # def solution(A, B, K) # that, given three integers A, B and K, returns the number of integers within the range [A..B] that are divisible by K, i.e.: # { i : A ≤ i ≤ B, i mod K = 0 }...
StarcoderdataPython
51425
# !/usr/bin/env python # coding=UTF-8 """ @Author: <NAME> @LastEditors: <NAME> @Description: @Date: 2021-08-18 @LastEditTime: 2022-03-19 """ import zipfile import pickle import gzip import json import re from pathlib import Path from typing import Union, Optional, Sequence from ..strings import normalize_language, LA...
StarcoderdataPython
23299
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
StarcoderdataPython
3318646
############################################################################## # # Copyright (c) 2009 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
StarcoderdataPython
3379746
# Author: <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 wr...
StarcoderdataPython
4821398
# coding=utf-8 import pywikibot import re from pywikibot import pagegenerators from time import sleep CATEGORY_EN = 'Flags by year of introduction' CATEGORY_RU = 'Флаги по годам' PATTERN_EN = 'Category:Flags introduced in %s' PATTERN_RU = 'Категория:Флаги %s года' PATTERN_YEAR = '([0-9]+)' site_en = pywikibot.Sit...
StarcoderdataPython
1618282
<filename>tools/assetlib_release.py #! /usr/bin/env python3 """ Build system is designed to created a build targetting a single platform. This script aims at bundle together multiple builds to generate a final multi-platform release. """ import json from pathlib import Path from urllib.request import urlopen import ...
StarcoderdataPython
3241641
<gh_stars>100-1000 import os from conans import ConanFile, CMake, tools class EABaseConan(ConanFile): name = "eabase" description = "EABase is a small set of header files that define platform-independent data types and platform feature macros. " topics = ("conan", "eabase", "config",) license = "BSD-3...
StarcoderdataPython
63688
from __future__ import print_function import os.path import tempfile import shutil from pype9.cmd import convert import ninemlcatalog from nineml import read from lxml import etree import yaml if __name__ == '__main__': from pype9.utils.testing import DummyTestCase as TestCase # @UnusedImport else: from unitte...
StarcoderdataPython
3203662
<reponame>enthought/etsproxy<gh_stars>1-10 # proxy module from __future__ import absolute_import from apptools.naming.context_adapter_factory import *
StarcoderdataPython
1715290
from natch.abstract import Registry as AbstractRegistry from natch.hashers import QualnameHasher class Registry(AbstractRegistry): def __init__(self, *args, **kwargs): super(Registry, self).__init__(*args, **kwargs) def set_hasher(self, hasher): if hasher is None: hasher = Qualna...
StarcoderdataPython
189914
import json def load_dictionary_from_file(file_path): """Load a dictionary from a JSON file. Parameters ---------- file_path : string The JSON file path to load the dictionary from. Returns ------- dictionary : dict The dictionary loaded from a JSON file. """ with...
StarcoderdataPython
3345494
# 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 # "License"); you may not u...
StarcoderdataPython
3370005
# -*- coding: utf-8 -*- import logging import copy import json import os # from rest_framework.decorators import api_view # from rest_framework.response import Response from django.template.response import TemplateResponse from django.shortcuts import redirect from utils.shell_runner import get_cmd_stdout from proj...
StarcoderdataPython
3221274
from molsysmt._private.digestion import digest_item, digest_atom_indices, digest_structure_indices def to_openmm_Modeller(item, atom_indices='all', structure_indices='all', check=True): if check: digest_item(item, 'file:gro') atom_indices = digest_atom_indices(atom_indices) structure_indi...
StarcoderdataPython
4805498
from django.contrib import admin # Register your models here. from .models import Project, Position, UserCompletedProject admin.site.register(Project) admin.site.register(Position) admin.site.register(UserCompletedProject)
StarcoderdataPython
3335421
<filename>picture/migrations/0007_auto_20161013_2250.py # -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-10-13 22:50 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('pic...
StarcoderdataPython
3353922
<filename>PDF/utils.py import random from collections import defaultdict import numpy as np from keras import backend as K from keras.models import Model from configs import feature_constraints def normalize(x): # utility function to normalize a tensor by its L2 norm return x / (K.sqrt(K.mean(K.square(x))) +...
StarcoderdataPython
3366294
import threading import time from nephelae_base.types import NavigationRef from nephelae_base.types import Position from nephelae_base.types import SensorSample from nephelae_base.types import MultiObserverSubject from .SpatializedDatabase import SpatializedDatabase from .SpatializedDatabase import SpbEntry # from n...
StarcoderdataPython
115712
import itertools import logging import os import geopandas as gpd import numpy as np import pandas as pd import tqdm from scipy.spatial import KDTree from shapely.geometry import LineString, Point, Polygon from delft3dfmpy.converters import hydamo_to_dflowrr from delft3dfmpy.core import checks, geometry from delft...
StarcoderdataPython
3269808
<reponame>PavriLab/classifyIS-nf #!/usr/bin/env python import pandas as pd import argparse as ap import numpy as np import logging if __name__ == '__main__': logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.INFO) parser = ap.ArgumentParser(description='''converts readcounts of IS to log2(...
StarcoderdataPython
3201471
<filename>spotify_dashboard/spotify/migrations/0007_auto_20200322_1350.py # Generated by Django 2.2.11 on 2020-03-22 13:50 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('spotify', '0006_update'), ] operations =...
StarcoderdataPython
1752892
import asyncio from threading import Thread import pytest from slack_sdk.web.async_client import AsyncWebClient from slack_bolt.adapter.socket_mode.websockets import AsyncSocketModeHandler from slack_bolt.app.async_app import AsyncApp from tests.mock_web_api_server import ( setup_mock_web_api_server, cleanup_...
StarcoderdataPython
3264112
import tensorflow as tf from . import custom_layers class Discriminator(object): """Discriminator that takes image input and outputs logits. Attributes: name: str, name of `Discriminator`. kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. b...
StarcoderdataPython
1792445
import os TOKEN = os.environ['TOKEN'] PARKING_CHAT_ID = os.environ['PARKING_CHAT_ID'] BASE_DIR = os.path.dirname(os.path.abspath(__file__)) DBPATH = os.path.join(BASE_DIR, "db1e3bfkg2bidc") DATABASE_URL = os.environ.get("DATABASE_URL") HOME_URL = os.environ['HOME_URL'] SALT = os.environ['SALT']
StarcoderdataPython