id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
3314752
import math import geopy.distance class CategorySimilarityNaive(object): """ Similarity measure for categorical attributes defined manually """ def compute_similarity(self, col, val1, val2, aggr_col): # print(col, val1, val2) if col not in self.cate_cols: return 0 if co...
StarcoderdataPython
11322399
<gh_stars>1-10 import pandas as pd import numpy as np import s3fs def preprocess(s3_in_url, s3_out_bucket, s3_out_prefix, delimiter=","): """Preprocesses data based on business logic - Reads delimited file passed as s3_url and preprocess data by filtering long...
StarcoderdataPython
25826
from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_script import Manager from flask_migrate import Migrate, MigrateCommand app = Flask(__name__) app.config[ 'SQLALCHEMY_DATABASE_URI'] = 'postgres://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' db = SQLAlchemy(app) migrate = Migrate(app, db) manage...
StarcoderdataPython
5129644
<reponame>EUMSSI/EUMSSI-platform #!/usr/bin/env python import pymongo import time import datetime from eumssi_converter import EumssiConverter def transf_date(x): if x.__class__==datetime.datetime: return x else: try: return datetime.datetime.strptime(x,'%Y-%m-%dT%H:%M:%S.000Z') #2...
StarcoderdataPython
12827704
import datetime import scrapy from scrapy.loader import ItemLoader from itemloaders.processors import MapCompose, TakeFirst from exchanges.twse.items import BranchSettlementItem from exchanges.twse.handlers import StockBranchHandler as Handler class BranchSettlementSpider(scrapy.Spider): name = 'twse_branch_set...
StarcoderdataPython
3222011
import os from flask import Flask from flask import request from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager from flask_bootstrap import Bootstrap from flask_pagedown import PageDown from flask_uploads import UploadSet, IMAGES, configure_uploads app = Flask(__name__) app.config.from_objec...
StarcoderdataPython
9747546
<reponame>karenang/ivle-bot from . import api class Announcement(): # Announcement.Announcements def announcements(self, courseId, duration=0, titleOnly=False, auth=True): params = {'CourseID': courseId, 'Duration': duration, 'TitleOnly': titleOnly} return api.call('Announcements', params, auth...
StarcoderdataPython
288182
<filename>type4py/preprocess.py<gh_stars>10-100 from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder from type4py import logger, AVAILABLE_TYPES_NUMBER, MAX_PARAM_TYPE_DEPTH from libsa4py.merge import merge_jsons_to_dict, create_dataframe_fns, create_dataframe_vars from li...
StarcoderdataPython
5044769
# Generated by Django 3.0.3 on 2021-09-15 13:52 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('workspaces', '0014_workspacegeneralsettings_je_single_credit_line'), ] operations = [ migrations.AddField( model_name='workspace...
StarcoderdataPython
3576527
from astroid import MANAGER, register_module_extender from astroid.builder import AstroidBuilder CODE_FIX = """ class md5(object): def __init__(self, value=None): pass def hexdigest(self): return u'' def update(self, x): return u'' def digest(self): return u'' class sh...
StarcoderdataPython
9694560
import glob from astro import bot from sys import argv from telethon import TelegramClient from astro.config import Config from astro.utils import load_module, start_assistant, load_pmbot from pathlib import Path import telethon.utils from astro import CMD_HNDLR GROUP = Config.PRIVATE_GROUP_ID BOTNAME = Config.BOT_USE...
StarcoderdataPython
3247752
<filename>src/tests/fidl/dangerous_identifiers/generate/uses.py # Copyright 2020 The Fuchsia Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. __all__ = ["USES"] from typing import List from common import * # Define places that identi...
StarcoderdataPython
8071763
import numpy as np import hashlib import random # ########################################################################## # Example of an encrypted system in operation. This works with a few # assumptions that can be adjusted: # * Getting within approximately 70' is close enough to note # * "Infection" stick...
StarcoderdataPython
3597567
<gh_stars>10-100 from bitmovin_api_sdk.encoding.filters.unsharp.customdata.customdata_api import CustomdataApi
StarcoderdataPython
5075128
import re def parse_level(levels): parsedLevels = {} classLevels = levels.split(',') for level in classLevels: # make ' cleric 0' into ['cleric', 0] classAndLevel = level.strip().split(' ') try: if classAndLevel[0].find('/') > 0: # if it's sorcerer/wiza...
StarcoderdataPython
9652717
# kamikaze112213 by hephaestus # http://robotgame.org/viewrobot/5830 import rg import operator class Robot: def act(self, game): adjacent_robots = self.get_adjacent_robots(game) adjacent_friendlies = self.get_adjacent_robots(game, operator.__eq__) adjacent_enemies = self.get_adjacent_robo...
StarcoderdataPython
61741
<reponame>john-james-sf/DataStudio<gh_stars>0 #!/usr/bin/env python3 # -*- coding:utf-8 -*- # =========================================================================== # # Project : Data Studio # # Version : 0.1.0 ...
StarcoderdataPython
9697172
<reponame>dummas2008/AndroidChromium<filename>libraries_res/chrome_res/src/main/res/PRESUBMIT_test.py #!/usr/bin/env python # Copyright 2017 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. import os import sys import unitt...
StarcoderdataPython
9792982
import os from models.data.base_object_detector import BaseObjectDetector from models.data.bounding_box import BoundingBox from typing import List IMAGE_FILES_EXTENSIONS = [ '.jpg', '.jpeg', '.png' ] def write_image_predictions( path_to_output_directory: str, filename: str, bounding_boxes: Li...
StarcoderdataPython
8039432
import xml.etree.ElementTree as ET import os import glob import regex as re import platform from pathlib import Path class ClipItem(): def __init__(self, name, path, duration, in_frame, out_frame, out_width, out_height): duration = int(duration) in_frame = int(in_frame) out_frame = int(out_frame) se...
StarcoderdataPython
8069155
import argparse import os import sys from subprocess import Popen, PIPE from pathlib import Path def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('root') return parser.parse_args() def get_values(): import xarray as xr while True: path = (yield) item = [_ fo...
StarcoderdataPython
1980728
"""ImageProxy support.""" import base64 import dataclasses as dc import hashlib import hmac from typing import Union, Optional, Sequence from functools import partial # py37 try: from typing import Literal # type: ignore except ImportError: from typing_extensions import Literal # type: ignore __version__ ...
StarcoderdataPython
3491733
import pytest import basix import basix.ufl_wrapper @pytest.mark.parametrize("inputs", [ ("Lagrange", "triangle", 2), ("Lagrange", basix.CellType.triangle, 2), (basix.ElementFamily.P, basix.CellType.triangle, 2), (basix.ElementFamily.P, "triangle", 2), ]) def test_create_element(inputs): basix.ufl...
StarcoderdataPython
3215276
<reponame>jiawenanan/Database #!/usr/bin/env python # coding: utf-8 # In[66]: import pandas as pd import numpy as np import zipfile prison = pd.read_csv('~/Desktop/Prison_Admissions__Beginning_2008.csv') house = pd.read_csv('~/Desktop/County_zhvi_uc_sfrcondo_tier_0.33_0.67_sm_sa_mon.csv') vpf = pd.read_csv('~/Deskto...
StarcoderdataPython
1806126
""" Platform entity for the GMG project """ import json class Platform: """ This class represent a platform (support), for instance "Playstation" """ def __init__(self, platform_id, platform_name, game_count): self.platform_id = platform_id self.platform_name = platform_name self.game_...
StarcoderdataPython
3535598
<gh_stars>0 """ Given a non-empty string like "Code" return a string like "CCoCodCode". string_splosion('Code') → 'CCoCodCode' string_splosion('abc') → 'aababc' string_splosion('ab') → 'aab' """ def string_splosion(str): string = "" for x in range(len(str)): string += str[:x+1] return string
StarcoderdataPython
4843281
<gh_stars>10-100 # Write your code here str1 = input() vowels = ["A","E","I","O","U","Y"] a = int(str1[1]) + int(str1[0]) b = int(str1[3]) + int(str1[4]) c = int(str1[4]) + int(str1[5]) d = int(str1[7]) + int(str1[8]) if(a%2 == 0 and b%2 == 0 and c%2 == 0 and d%2 == 0 and str1[2] not in vowels) : print("valid") el...
StarcoderdataPython
9672108
<reponame>CheerL/lancunar import torch import torch.nn as nn import torch.nn.functional as F def passthrough(x, **kwargs): return x def ELUCons(elu, nchan): if elu: return nn.ELU(inplace=True) else: return nn.PReLU(nchan) class LUConv(nn.Module): def __init__(self, inChans, outCha...
StarcoderdataPython
5196728
<filename>testsuite/Testlib/TestServer/TestPlugin.py import os import re import sys import copy import logging import lxml.etree import Bcfg2.Server from Bcfg2.Bcfg2Py3k import reduce from mock import Mock, MagicMock, patch from Bcfg2.Server.Plugin import * # add all parent testsuite directories to sys.path to allow (...
StarcoderdataPython
1999744
<reponame>tinycord/tinycord import typing import asyncio from .utils import setup_arg, setup_callback from .exceptions import CommandNotFound class CommandBase: """ This is the base class of the CommandClient. """ commands: typing.Dict[str, typing.Dict[str, typing.Any]] = {} def add_command(s...
StarcoderdataPython
3414945
<filename>tests/test_docs_complete.py<gh_stars>10-100 import os import pytest MODULES_PATH = './modules' def get_submodules(module): pkg_name = module.replace('scikit-surgery', 'sksurgery') submodules_path = os.path.join(MODULES_PATH, module, pkg_name) # Get all files recursively (https://stackoverflow....
StarcoderdataPython
4947227
# -*- coding: utf-8 -*- """Tree Level Order.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1S75hNh7pHJXaZpvoiL7ztrFuuQRWzahr """ class Node(object): def __init__(self, val=None): self.left = None self.right = None self.val = val d...
StarcoderdataPython
1839375
# -*- coding: utf-8 import six from importlib import import_module from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.apps import AppConfig from . import connections, logger, flexconfig class ElasticsearchFlexConfig(AppConfig): name = 'elasticsearch_flex' ...
StarcoderdataPython
9700848
"""Tests for calibration measure functions.""" import pytest from probnumeval.timeseries import ( average_normalised_estimation_error_squared, chi2_confidence_intervals, non_credibility_index, non_credibility_index2, non_credibility_index3, ) def test_anees(): with pytest.raises(NotImplemente...
StarcoderdataPython
6478913
<reponame>slalom-ggp/dataops-tools """ slalom.dataops.sparkutils module """ import datetime import importlib.util import time import os import sys from pathlib import Path import docker import fire import pyspark from py4j.java_gateway import java_import from pyspark import SparkContext, SparkConf fro...
StarcoderdataPython
92225
#!/usr/bin/python # -*- coding: utf-8 -*- # ABC is the AbstractBaseClass in python from abc import ABC, abstractmethod # Judge is an abstract class to be subclassed and implemented # by Judge developers. # Judge class kind of doubles up for login-logout as well as a Factory # for the contest and problem classes for...
StarcoderdataPython
1797570
# coding: utf-8 from django.conf import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.contrib import admin from django.contrib.auth import views as auth_views from django.core.urlresolvers import reverse_lazy from django.views.generic import RedirectView url...
StarcoderdataPython
9657425
<reponame>584807419/FreeProxyPool import re from proxypool.schemas.proxy import Proxy from proxypool.crawlers.base import BaseCrawler class xilaCrawler(BaseCrawler): urls = ['http://www.xiladaili.com/http/', 'http://www.xiladaili.com/http/2/', 'http://www.xiladaili.com/http/3/', 'http://www.xiladaili....
StarcoderdataPython
1721821
<gh_stars>0 #Sensitivity to sizing assumptions for New York airport shuttle service import os import sys sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/../..')) import numpy as np from gpkit import Model, ureg from matplotlib import pyplot as plt from aircraft_models import OnDemandAircraft from aircr...
StarcoderdataPython
3421393
<reponame>beryldb/python-beryl # BerylDB - A modular database. # http://www.beryldb.com # # Copyright (C) 2021 <NAME> <<EMAIL>> # # This file is part of BerylDB. BerylDB is free software: you can # redistribute it and/or modify it under the terms of the BSD License # version 3. # # More information about our licensing...
StarcoderdataPython
12864618
<filename>scraper/engine.py import sys import csv import requests from parsel import Selector from scraper.parser import get_features_from_item start_url = 'http://www.world-art.ru/animation/rating_top.php' SIGN_STDOUT = '-' FORMAT_CSV = 'csv' FORMAT_JL = 'jl' def parse(url: str, out_path: str, out_format: str): ...
StarcoderdataPython
8100385
<filename>src/commands/generators/lib.py import os, json, sys def load(file): with open(file, 'r') as fi: data = fi.read() return json.loads(data) def makeScript(name,content): with open(name, 'w') as fi: data = fi.write(content) return data def plural(word): return word + "s"
StarcoderdataPython
6459864
""" Test of Summary tables. This has many test cases, so to keep files smaller, it's split into two files: test_summary.py and test_summary2.py. """ import actions import logger import objtypes import test_engine import test_summary from test_engine import Table, Column, View, Section, Field log = logger.Logger(__nam...
StarcoderdataPython
6702381
<reponame>make-itrain/pyllhttp from setuptools import setup, Extension from os import path this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name = 'llhttp', version = '6.0.2.0', descriptio...
StarcoderdataPython
110321
# The MIT License (MIT) # Copyright (c) 2014 <NAME> <<EMAIL>> # 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, copy, mo...
StarcoderdataPython
6688547
import subprocess from setuptools import setup, find_packages from setuptools.command.install import install try: from pip._internal.req import parse_requirements except ImportError: from pip.req import parse_requirements def load_requirements(file_name): requirements = parse_requirements(file_name, ses...
StarcoderdataPython
4817890
from pydantic import BaseModel from prisma.generator import GenericGenerator, GenericData, Manifest # custom options must be defined using a pydantic BaseModel class Config(BaseModel): my_option: int # we don't technically need to define our own Data class # but it makes typing easier class Data(GenericData[Con...
StarcoderdataPython
6402243
<reponame>YesmynameisPerry/pezLogger<filename>pezLogger/src/mockLogger.py from pezLogger.src.base.baseLogger import BaseLogger from typing import Any, Dict __all__ = ["MockLogger"] # Mock logger to be used in tests and all class MockLogger(BaseLogger): def __init__(self, *args, suppress: bool = True) -> None: ...
StarcoderdataPython
9756306
<reponame>okara83/Becoming-a-Data-Scientist """Distance to Nearest Vowel Write a function that takes in a string and for each character, returns the distance to the nearest vowel in the string. If the character is a vowel itself, return 0. Examples distance_to_nearest_vowel("aaaaa") ➞ [0, 0, 0, 0, 0] distance_to_near...
StarcoderdataPython
215582
# !/usr/bin/env python3 # -*- coding:utf-8 -*- # @Datetime : 2019/11/13 下午2:45 # @Author : Fangyang # @Software : PyCharm from PyQt5.QtWidgets import ( QPushButton, QWidget, QLineEdit, QApplication ) import sys class Button(QPushButton): def __init__(self, title, parent): super().__init__(title, ...
StarcoderdataPython
5051062
<filename>rapiduino/boards/arduino.py from typing import Dict, Optional, Tuple, Type from rapiduino.boards.pins import Pin, get_mega_pins, get_nano_pins, get_uno_pins from rapiduino.communication.command_spec import ( CMD_ANALOGREAD, CMD_ANALOGWRITE, CMD_DIGITALREAD, CMD_DIGITALWRITE, CMD_PARROT, ...
StarcoderdataPython
20790
<reponame>will-bainbridge/ISITEK #!/usr/bin/python ################################################################################ import numpy import os import cPickle as pickle import scipy.misc import scipy.sparse import scipy.sparse.linalg import scipy.special import sys import time class Struct: def __init__(...
StarcoderdataPython
4954295
<reponame>max-farver/rl-bot-hack-kstate from util.orientation import Orientation, relative_location from rlbot.agents.base_agent import BaseAgent, SimpleControllerState from rlbot.messages.flat.QuickChatSelection import QuickChatSelection from rlbot.utils.structures.game_data_struct import GameTickPacket from util.bal...
StarcoderdataPython
11296038
#!/usr/bin/env python import unittest from chirp.common import timestamp from chirp.library import constants from chirp.library import ufid class UFIDTest(unittest.TestCase): def test_basic(self): test_vol = 11 test_ts_human = "20090102-030405" test_ts = timestamp.parse_human_readable(t...
StarcoderdataPython
11259508
<reponame>jschmer/rxv<filename>rxv/rxv.py #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import copy import logging import re import time import warnings import xml from collections import namedtuple from math import floor import requests from defusedxml...
StarcoderdataPython
4872225
import usocket as socket except: import socket from time import sleep from machine import Pin import onewire, ds18x20 import network import esp esp.osdebug(None) import gc gc.collect() ds_pin = Pin(22) ds_sensor = ds18x20.DS18X20(onewire.OneWire(ds_pin)) ssid = 'Du-kommst-hier-nicht-rein' password = '<PASSWORD>...
StarcoderdataPython
4836317
<filename>tests/projections/test_projection_specifications.py import psyneulink as pnl import numpy as np import pytest import psyneulink.core.components.functions.distributionfunctions import psyneulink.core.components.functions.statefulfunctions.integratorfunctions import psyneulink.core.components.functions.transfe...
StarcoderdataPython
379436
"""Read customised MetOcean Solutions WW3 spectra files.""" import numpy as np import xarray as xr from wavespectra.core.attributes import attrs, set_spec_attributes from wavespectra.specdataset import SpecDataset def read_ww3_msl(filename_or_fileglob, chunks={}): """Read Spectra from WAVEWATCHIII MetOcean Solut...
StarcoderdataPython
11273131
<reponame>kagemeka/atcoder-submissions<gh_stars>1-10 import sys import typing import numpy as np def main() -> typing.NoReturn: n = int(input()) a = np.array( sys.stdin.read().split(), dtype=np.int64, ).reshape(n, 3) j = np.arange(3) j = np.vstack((j + 1, j + 2)) j %= 3 dp = np.zeros( 3, ...
StarcoderdataPython
11274765
__________________________________________________________________________________________________ sample 28 ms submission from collections import defaultdict,Counter class Solution: def longestSubstring(self, s: str, k: int) -> int: """ :type s: str :type k...
StarcoderdataPython
3240079
# Generated by Django 3.2.2 on 2021-05-14 08:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('portfolio', '0002_auto_20210514_0746'), ] operations = [ migrations.AddField( model_name='portfolio', name='location...
StarcoderdataPython
8162668
from flask_restful import Resource from app.vendors.rest import response class HealthCheck(Resource): def get(self): data = { "status": "running", } return response(200, data=data, message="OK")
StarcoderdataPython
164825
<filename>ifaces/management/__init__.py """Management modules for ifaces"""
StarcoderdataPython
290611
<reponame>Crown-Commercial-Service/digitalmarketplace-developer-tools import re import ast import setuptools _version_re = re.compile(r"__version__\s+=\s+(.*)") with open("dmdevtools/__init__.py", "rb") as f: version = str( ast.literal_eval(_version_re.search(f.read().decode("utf-8")).group(1)) ) wi...
StarcoderdataPython
214930
<gh_stars>10-100 from arekit.common.context.terms_mapper import TextTermsMapper from arekit.common.entities.base import Entity from arekit.common.entities.str_fmt import StringEntitiesFormatter from arekit.common.entities.types import EntityType from arekit.common.frames.text_variant import TextFrameVariant from arekit...
StarcoderdataPython
9774518
<reponame>JiahnChoi/opsdroid.kr """The version subcommand for opsdroid cli.""" import click from opsdroid import __version__ @click.command() @click.pass_context def version(ctx): """Print out the version of opsdroid that is installed and exits. Args: ctx (:obj:`click.Context`): The current click c...
StarcoderdataPython
4851615
<reponame>gordonwatts/func-adl-types-atlas import ast import copy import re from dataclasses import dataclass from pathlib import Path from typing import Optional, Tuple, TypeVar import jinja2 from func_adl import ObjectStream from func_adl.ast.meta_data import lookup_query_metadata @dataclass class CalibrationEvent...
StarcoderdataPython
5192467
<reponame>cbertelegni/scrap_temmperatura #!/usr/bin/python # -*- coding: utf-8 -*- import requests, re, os from datetime import datetime HEADERS = { 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36', 'Referer':'http://www.smn.gov.ar/?mod=prensa&id...
StarcoderdataPython
8136968
#!python3 import io import sys import datetime import names from gen_random_values import * lista = [] repeat = 100 with io.open('fixtures.json', 'wt') as f: for i in range(repeat): date = datetime.datetime.now().isoformat(" ") fname = names.get_first_name() lname = names.get_last_name() ...
StarcoderdataPython
8039744
<gh_stars>0 # -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # Name: state # Purpose: Retrieve and recreate state of objects # # Author: <NAME> (<EMAIL>) # # Copyright: (c) 2014 <NAME> # License: This program is part of a larger application. Fo...
StarcoderdataPython
9638356
# <NAME> 0210315552 def solve(): d_list = ["Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"] ## Get input (iy, im, id) = getInputs() ## Check if Jan or Feb if (im == 1 or im == 2): im += 12 iy += -1 ## Insert into Zeller's Congruence...
StarcoderdataPython
12845010
<filename>exercicios/ex041.py # Classificando Atletas from datetime import date from time import sleep n = str(input('\033[1;30mDigite o seu nome completo: ')).strip().title() a = int(input('Digite o seu ano de nascimento: ')) anoatual = date.today().year i = anoatual - a print('') sleep(1.75) print('ANALISANDO...') sl...
StarcoderdataPython
9748423
#MenuTitle: Compare Font Spacings # -*- coding: utf-8 -*- __doc__=""" Compare spacing of open fonts, output in the Macro Window. """ abc = "abcdefghijklmnopqrstuvwxyz" frequencies = { # Source: Wikipedia "a": 0.08167, "b": 0.01492, "c": 0.02782, "d": 0.04253, "e": 0.12702, "f": 0.02228, "g": 0.02015, "h": 0....
StarcoderdataPython
195436
import re #import datetime from random import randrange import time class testHelperSM: def __init__(self, app): self.app = app # def find_region(self): # wd = self.app.wd # wd.find_element_by_xpath("//div[@id='mCSB_2_container']/ul/li[2]/label") # wd.find_element_by_xpath("//fo...
StarcoderdataPython
9649348
from communication.tsm.utils import convert_pos_to_embdeding from communication.dcel.dcel import Dcel import networkx as nx class Planarization: '''Determine the topology of the drawing which is described by a planar embedding. ''' def __init__(self, G, pos=None): if (pos == None): pos ...
StarcoderdataPython
4900821
<filename>company/InfyTQ/Fundamentals/02SET/09numberGame.py<gh_stars>0 def getSum(n): sum = 0 for digit in str(n): sum += int(digit) return sum def twoDigit(n): if(1 < n < 100): return True else: return False def find_max(num1, num2): max_num = -1 list = [] if...
StarcoderdataPython
3460400
<filename>datacode/panel/did/reg.py from typing import List, Tuple, Optional import pandas as pd from regtools.interact import _interaction_tuple_to_var_name from regtools import reg_for_each_yvar_and_produce_summary def diff_reg_for_each_yvar_and_produce_summary(diff_df: pd.DataFrame, yvars: List[str], treated_var: ...
StarcoderdataPython
4892899
from functools import wraps from importlib import resources as il_resources import logging import os from zygoat.components import Component from zygoat.constants import Phases from zygoat.components import resources log = logging.getLogger() class FileComponent(Component): """ Use this when you want to cr...
StarcoderdataPython
6677528
from baseline.tf.lm.train import * from baseline.tf.lm.model import *
StarcoderdataPython
6686733
import os from PIL import Image def file_expand_pic(file,font_height): img = Image.open(file) w, h = img.size line_count = int(h/font_height) to_img = Image.new(mode='RGBA',size=(w,line_count*256)) for line in range(line_count): to_img.paste(img.crop(box=(0, font_height*line, w, font_heigh...
StarcoderdataPython
3211166
<gh_stars>1-10 import time import rospy import rospkg import os import sys import numpy as np import tensorflow as tf from styx_msgs.msg import TrafficLight from io import StringIO MINIMUM_CONFIDENCE = 0.4 class TLClassifier(object): def __init__(self, simulator): # current_path = os.path.dirname(os.pat...
StarcoderdataPython
8067328
<gh_stars>0 #!/usr/bin/env python import time class ProfilerStopwatch(object): """Time counter class to help us optimize performance A quick walltime performance counter. Can run multiple clocks at the same time for different classes of things. """ _default_tag = 'DEFAULT' def __init__...
StarcoderdataPython
1992494
from werkzeug.security import check_password_hash, generate_password_hash import mysql.connector, random # Connect to database db = mysql.connector.connect( host="localhost", user="root", password="password", database="testing", auth_plugin="mysql_native_password", charset="utf8mb4" ) cursor =...
StarcoderdataPython
5008832
import csv import pandas as pd ''' Commentaires E-CUBE (Marwane) : - Commentaires généraux : - Structurer le dossier en sous-dossiers contenant des fichiers de nature distincte. Typiquement : - data : contient toutes les données, dont celles qui sont scrapées - lib : contient tous les scripts Pyth...
StarcoderdataPython
1716135
<reponame>jkrueger/phosphorus_mk2 def init(): import bpy from . import (_phosphoros) import os.path path = os.path.dirname(__file__) user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', ''))) resource_path = os.path.dirname(os.path.abspath(bpy.utils.resource_path('LOCA...
StarcoderdataPython
11263187
# -*- coding: utf-8 -*- """ Created on Fri Dec 7 16:56:44 2018 @author: lijun """ """ This model is based on Tensorflow-1.14. How to use? out1,out2=CRMSS(img1,img2,reuse=False) img1 and img2 are inputs that are nomalized between 0~1. out1 and out2 are corresponding cloud removal results for img1 and img2. ...
StarcoderdataPython
3202587
<filename>exdir/core/validation.py from enum import Enum import os try: import pathlib except ImportError as e: try: import pathlib2 as pathlib except ImportError: raise e from . import constants as exob VALID_CHARACTERS = ("abcdefghijklmnopqrstuvwxyz1234567890_-.") class NamingRule(Enum)...
StarcoderdataPython
6436786
<reponame>tkoyama010/pyvista-doc-translations from pyvista import examples dataset = examples.download_topo_global() # doctest:+SKIP # # This dataset is used in the following examples: # # * :ref:`surface_normal_example`
StarcoderdataPython
3594866
"""Main package to interface with Zotero API.""" import datetime import logging import os import requests NEW_VER = datetime.datetime.today().strftime("%Y%m%d") logger = logging.getLogger(__name__) class Zoter: """Class for interacting with Zotero API.""" def __init__(self, user_id: str = os.environ.get(...
StarcoderdataPython
3271732
<reponame>das08/kuRakutanBot import module.func as fn command = { "help": fn.helps, "Help": fn.helps, "ヘルプ": fn.helps, "テーマ変更": fn.selectTheme, "きせかえ": fn.selectTheme, "着せ替え": fn.selectTheme, "テーマ": fn.selectTheme, "色テーマ": fn.selectTheme, "色テーマ変更": fn.selectTheme, "t...
StarcoderdataPython
8141767
<gh_stars>0 """Nox sessions. Things I might want to consider: ******************************** * safety * typeguard * codecov """ import os import nox from nox.sessions import Session PACKAGE = 'peregrinus' nox.options.sessions = 'lint', 'mypy', 'unit_tests', 'doc_tests', 'wheel' locations = 'src', 'tests', 'docs...
StarcoderdataPython
6575292
<filename>rllib/models/tf/layers/noisy_layer.py import numpy as np from ray.rllib.utils.framework import get_activation_fn, get_variable, \ try_import_tf tf1, tf, tfv = try_import_tf() class NoisyLayer(tf.keras.layers.Layer if tf else object): """A Layer that adds learnable Noise to some previous layer's ou...
StarcoderdataPython
4989383
import scramble import movesticker import tkinter as tk import csv import os from datetime import datetime import time #基本視窗 win = tk.Tk() win.title('Random Scramble Generator') win.geometry('1440x900') win.config(background = '#323232') time_list = [] sc_list = [] #顯示打亂圖形 labelList = [] def draw_scramble(): ...
StarcoderdataPython
109960
<reponame>nathandarnell/sal """General functional tests for the text_utils module.""" from django.test import TestCase from utils import text_utils class TextUtilsTest(TestCase): """Test the Utilities module.""" def test_safe_text_null(self): """Ensure that null characters are dropped.""" ...
StarcoderdataPython
1956846
<reponame>EnjoyLifeFund/py36pkgs #!/usr/bin/python # # Copyright (c) 2016 <NAME>, <<EMAIL>> # <NAME>, <<EMAIL>> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Softwa...
StarcoderdataPython
9783611
<reponame>rrajaravi/pydfs<filename>setup.py from setuptools import setup def readme(): return open('README.md', 'r').read() def requirements(): with open('requirements.txt', 'r') as f: return f.readlines() setup( name='pydfu', packages=['pydfu'], version='0.1', long_description=rea...
StarcoderdataPython
197655
<filename>src/pylisp.py import sys import re from object import * from compiler import compile from vm import VM class Reader: def __init__(self, stream): self.stream = stream self.c = None def read_char(self): ret_c = self.c if ret_c == "": return ret_c s...
StarcoderdataPython
6504907
<gh_stars>100-1000 # Information: https://clover.coex.tech/programming import rospy from clover import srv from std_srvs.srv import Trigger rospy.init_node('flight') get_telemetry = rospy.ServiceProxy('get_telemetry', srv.GetTelemetry) navigate = rospy.ServiceProxy('navigate', srv.Navigate) navigate_global = rospy.S...
StarcoderdataPython
1953956
<reponame>mgorny/python-zeep<gh_stars>1000+ import pytest from zeep import AsyncClient @pytest.mark.requests @pytest.mark.asyncio async def test_context_manager(): async with AsyncClient("tests/wsdl_files/soap.wsdl") as async_client: assert async_client
StarcoderdataPython
363433
""" Copy image file (e.g. ABC.JPG) to 20180605-ABC.JPG using EXIF timestamp Very simple script, expects to be executed from the dir where the images are and the filenames from stdin. Example: ls *.JPG | python ~/mywork/img-batch-renaming/foto-rename.py """ import sys import os from itertools import ch...
StarcoderdataPython