id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
52083
def obfuscate(utils_path, project_path): import subprocess print('Running obfuscator ...') subprocess.run(f'{utils_path}/confuser/Confuser.CLI.exe {project_path} -n')
StarcoderdataPython
3336769
# # pv_ifc.py # # Created on: Aug 16, 2008 # Author: dcoates PV_ACTION_INIT=1 PV_ACTION_ADD_LAYER=2 PV_ACTION_SET_LAYER_PARAMS=3 PV_ACTION_ADD_CONNECTION=4 PV_ACTION_RUN=5 PV_ACTION_SET_PARAMS=6 PV_ACTION_SET_INPUT_FILENAME=7 PV_ACTION_INJECT=8 PV_ACTION_MEASURE=9 PV_ACTION_FINALIZE=10 PV_ACTION_SETUP=11 PV_HAN...
StarcoderdataPython
3329207
from dna_functions import dseq_from_both_overhangs, both_overhangs_from_dseq, \ format_sequence_genbank, read_dsrecord_from_json import unittest from pydna.dseqrecord import Dseqrecord from pydna.dseq import Dseq from Bio.SeqFeature import FeatureLocation from pydna.seqfeature import SeqFeature from typing import O...
StarcoderdataPython
4829429
# Generated by Django 2.0.2 on 2018-03-09 18:14 import app.teams.models from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('auth', '0009_alter_user_last_name_max_length'), ('teams', '0002_team_members'), ] o...
StarcoderdataPython
1699319
'''Main setup and run loop for xcffibaer. ''' import asyncio import os import sys import xcffib import xcffib.render import xcffib.randr from xcffib.randr import NotifyMask, ScreenChangeNotifyEvent import i3ipc from . import Bar, Store, Window, XSetup from .atoms import initAtoms from .timers import addDelay from ....
StarcoderdataPython
3283242
#65 - maior ou menor,varios numeros e mostrar a media, #perguntar ao usuarios se quer ou nao continuar maior = menor = media = cont = 0 laco = 'S' while laco == 'S': n1 = int(input('Digite os valores: ')) cont +=1 if cont == 1: #se contador for igual a 1, ou seja a primeira vez q ele conta o primeiro numer...
StarcoderdataPython
106942
import pytest pytestmark = [ pytest.mark.requires_salt_states("echo.text"), ] def test_echoed(salt_call_cli): echo_str = "Echoed!" ret = salt_call_cli.run("state.single", "echo.echoed", echo_str) assert ret.exitcode == 0 assert ret.json assert ret.json == echo_str def test_reversed(salt_cal...
StarcoderdataPython
1712745
<reponame>Mouedrhiri/get-running-processes-with-ram-usage import psutil import wmi from tqdm import tqdm from time import sleep def progress(range): for i in tqdm(range, desc ="Progress : "): sleep(.1) f = wmi.WMI() l = [] #To Scan How Much Processing Tasks for process in f.Win32_Process(): ...
StarcoderdataPython
3241316
# -*- coding: utf-8 -*- '''Chemical Engineering Design Library (ChEDL). Utilities for process modeling. Copyright (C) 2017, <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...
StarcoderdataPython
1743027
<filename>st2common/st2common/models/db/sensor.py # Licensed to the StackStorm, Inc ('StackStorm') 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,...
StarcoderdataPython
1636519
#!/usr/bin/env python3 # -*- coding:utf8 -*- import PyQt5,sys,traceback from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import * from tkinter import Tk from tkinter.messagebox import showinfo import RC_tray import os,sys from googletrans import Translator def showbug(message): Tk().withdra...
StarcoderdataPython
4820324
<gh_stars>1-10 import setuptools with open("asent/about.py") as f: v = f.read() for l in v.split("\n"): if l.startswith("__version__"): __version__ = l.split('"')[-2] with open("README.md", "r") as f: long_description = f.read() setuptools.setup(version=__version__)
StarcoderdataPython
1709366
import tensorflow as tf import numpy as np import tensorflow_datasets as tfds (ds_train, ds_test), ds_info = tfds.load('HorsesOrHumans', split=['train', 'test'], with_info=True, as_supervised=True, shuffle_files=True) def normalize_img(image, label): """Normalizes images: `uint8` -> `float32`.""" return tf.cast(i...
StarcoderdataPython
134379
import sys import os import asyncio import dscframework import json import keras from keras.models import load_model from data import build_dataset import numpy as np version = 1 os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" model = load_model(("export/mdl_v%d.h5")%(version)) async def on_facedetect(head, data): print...
StarcoderdataPython
3265259
<filename>data/data.py import numpy as np from functools import partial from paddle.io import DataLoader from paddlenlp.data import Vocab, Pad, Stack from paddlenlp.datasets import load_dataset from .sampler import DistributedDynamicBatchSampler def read(src_path, tgt_path, is_test=False, has_target=False): ...
StarcoderdataPython
1761213
<reponame>wckdouglas/tgirt-dna-seq<gh_stars>1-10 #!/bin/env python import argparse import subprocess import os import sys def getOpt(): parser = argparse.ArgumentParser(description='Pipeline for trimming, mapping paired end plasma DNA') parser.add_argument('-1','--fq1',required=True, help='read1 fastqfile [st...
StarcoderdataPython
8026
# last edited: 10/08/2017, 10:25 import os, sys, glob, subprocess from datetime import datetime from PyQt4 import QtGui, QtCore import math #from XChemUtils import mtztools import XChemDB import XChemRefine import XChemUtils import XChemLog import XChemToolTips import csv try: import gemmi import pandas excep...
StarcoderdataPython
3391400
from typing import Any, Final, TypedDict import numpy as np import numpy.typing as npt HelloWorldType: Final[Any] = TypedDict("HelloWorldType", {"Hello": str}) IntegerArrayType: Final[Any] = npt.NDArray[np.int_]
StarcoderdataPython
1680855
from graphRL.envs.graphRL import graphRL
StarcoderdataPython
95602
# Autogenerated config.py # # NOTE: config.py is intended for advanced users who are comfortable # with manually migrating the config file on qutebrowser upgrades. If # you prefer, you can also configure qutebrowser using the # :set/:bind/:config-* commands without having to write a config.py # file. # # Documentation:...
StarcoderdataPython
51947
# -*- coding: utf-8 -*- """Hello module.""" import platform import sys def get_hello(): system = platform.system() py_version = sys.version_info.major if system == "Windows": if py_version < 3: return "Hello Windows, I'm Python2 or earlier!" else: return "Hello W...
StarcoderdataPython
3388632
<filename>rwb/editor/custom_notebook.py '''Tree-based Notebook TODO: decouple the notebook from the listbox. Let them communicate via events, or have them work together via an interface (eg: notebook.configure(tablist=self.tablist) ''' import os import Tkinter as tk import ttk from rwb.widgets import AutoScrollbar f...
StarcoderdataPython
122171
<reponame>gitter-badger/share-analytics from __future__ import absolute_import, unicode_literals import os import dj_database_url from .base import * #ALLOWED_HOSTS = ['share.osf.io/dashboard'] ALLOWED_HOSTS = ['*'] DEBUG=False if os.environ.get('DEIS'): DATABASES = { 'default': { 'ENGINE': o...
StarcoderdataPython
189897
""" mixcoatl.admin.billing_code --------------------------- Implements access to the DCM Billingcode API """ from mixcoatl.resource import Resource from mixcoatl.decorators.lazy import lazy_property from mixcoatl.decorators.validations import required_attrs from mixcoatl.utils import uncamel, camelize, camel_keys, unc...
StarcoderdataPython
1602188
<filename>chamber/config.py from django.conf import settings as django_settings DEFAULTS = { 'MAX_FILE_UPLOAD_SIZE': 20, 'MULTIDOMAINS_OVERTAKER_AUTH_COOKIE_NAME': None, 'DEFAULT_IMAGE_ALLOWED_CONTENT_TYPES': {'image/jpeg', 'image/png', 'image/gif'}, 'PRIVATE_S3_STORAGE_URL_EXPIRATION': 3600, 'AWS...
StarcoderdataPython
3216876
<reponame>codilime/contrail-controller-arch # # Copyright (c) 2013,2014 Juniper Networks, Inc. All rights reserved. # import gevent import os import sys import socket import errno import uuid import logging import coverage import cgitb cgitb.enable(format='text') import testtools from testtools.matchers import Equals...
StarcoderdataPython
1632050
<gh_stars>0 import api.tutils import time import sys import api.objmodel # Test configure ACI mode def testACIMode(testbed): api.tutils.info("testACIMode starting") api.objmodel.setFabricMode("aci") # Create a network testTen = api.objmodel.tenant('default') testNet = testTen.newNetwork("aciNet", ...
StarcoderdataPython
60240
<gh_stars>10-100 #!/usr/bin/env python3 # # Visualize filters in the network import time from math import sqrt import torch import torchvision from torch import nn from args import args from made import MADE from pixelcnn import PixelCNN from utils import ensure_dir, get_ham_args_features # Set args here or through...
StarcoderdataPython
1706907
<reponame>wikimedia/search-MjoLniR<gh_stars>10-100 from collections import defaultdict from functools import partial import tempfile from typing import cast, Any, Callable, Dict, List, Mapping, Optional import hyperopt import numpy as np from pyspark.sql import SparkSession import xgboost as xgb from mjolnir.training...
StarcoderdataPython
3281025
# -*- coding: utf-8 -*- """Tests that use cross-checks for generic methods Should be easy to check consistency across models Does not cover tsa Initial cases copied from test_shrink_pickle Created on Wed Oct 30 14:01:27 2013 Author: <NAME> """ from statsmodels.compat.pandas import assert_series_equal, assert_index_...
StarcoderdataPython
61272
import ctypes """ /*=======================================================================* * Fixed width word size data types: * * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers ...
StarcoderdataPython
3231668
# Copyright 2016 NTT DATA # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
StarcoderdataPython
61806
<filename>get_image_url.py import urllib.request import time import flickr N = 5 PATH = "data/queries.txt" def get_queries(path): queries = [] with open(path) as f: for line in f: q = line.strip() queries.append(q) return queries if __name__ == "__main__": queries =...
StarcoderdataPython
183335
""" Creates the views for the: - index page - FAQ page - About page - Contact Us page """ from django.shortcuts import render def get_index(request): """ Returns index page :param request: The request type :return: index page """ return render(request, 'index.html') def get_faq...
StarcoderdataPython
194163
import pandas as pd import json import glob def get_catalog(lst: list, num: int = 5): if num == 0: return lst lst += glob.glob(f"jsons_unzipped/{'*/'*num}/cata*.json", recursive=True) return get_catalog(lst, num-1) cats = get_catalog([], 7) cols = [c.split('\\')[-2] for c in cats] periods = [] l...
StarcoderdataPython
80199
import torch import torch.nn as nn #==============================<Abstract Classes>==============================# """ Class that acts as the base building-blocks of ProgNets. Includes a module (usually a single layer), a set of lateral modules, and an activation. """ class ProgBlock(nn.Modul...
StarcoderdataPython
3385070
<filename>library/microsoft_adcs_cert.py # READ LICENSE before using this module from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinteface'], 'supported_by': 'curated'} DOCUMENTA...
StarcoderdataPython
169989
from HSTB.kluster.gui.backends._qt import QtGui, QtCore, QtWidgets, Signal from HSTB.kluster.gui.common_widgets import SaveStateDialog from HSTB.kluster import kluster_variables class PatchTestDialog(SaveStateDialog): patch_query = Signal(str) # submit new query to main for data def __init__(self, parent=No...
StarcoderdataPython
3305196
<reponame>L-Net-1992/oneflow """ Copyright 2020 The OneFlow Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless requ...
StarcoderdataPython
3200339
from flask.ext.wtf import (Form, TextField, PasswordField, FormField, required, EqualTo, Email, ValidationError, Optional) from flask.ext.login import current_user from nano.models import User from nano.extensions import db class UserForm(Form): first_name = TextField(u'First...
StarcoderdataPython
4829936
<filename>bigml/centroid.py # -*- coding: utf-8 -*- #!/usr/bin/env python # # Copyright 2014-2020 BigML # # 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/...
StarcoderdataPython
3396147
import numpy as np from helpers import baseline_discretization, solve_set_based, solve_sample_based, comparison_wrapper from models import makeMatrixModel, makeSkewModel, makeDecayModel, make1DHeatModel # define problem dimensions inputDim, outputDim = 2, 2 # define reference parameter # refParam = np.array([0.5]*inpu...
StarcoderdataPython
1770906
<reponame>YasinEhsan/interview-prep #9.26 6:35pm def insert(intervals, new_interval): merged = [] start,end, i = 0,1,0 while i < len(intervals) and intervals[i][end] < new_interval[start]: merged.append(intervals[i]) i+=1 while i < len(intervals) and intervals[i][start] <= new_interval[end]: new_...
StarcoderdataPython
1632153
<filename>fakerfaker.py import torch import numpy as np import sys def fake_prob(upper, quantile=0.999, mode="exp"): if mode == "exp": beta = - upper / (np.log(1 - quantile)) return beta elif mode == "lognorm": pass else: sys.exit(f"NOT support mode {mode}") def fake_data(n...
StarcoderdataPython
143105
import copy import numpy as np import pytest import tensorflow as tf from tfsnippet.layers import as_gated def safe_sigmoid(x): return np.where(x < 0, np.exp(x) / (1. + np.exp(x)), 1. / (1. + np.exp(-x))) class AsGatedHelper(object): def __init__(self, main_ret, gate_ret): self.main_args = None ...
StarcoderdataPython
1635573
# -*- coding: utf-8 -*- """ Created on Fri Sep 13 06:55:29 2019 @author: Joule """ from sender_reciever import Reciever, Sender from affine import Affine from ubrytelig import Ubrytelig class Hacker(Reciever): """Brute force hacker! Denne versjonen trenger ikke å få det brukte cipheret som input...
StarcoderdataPython
3210020
import os import sys import tempfile import zipfile def create_importable_zip(filename): z = zipfile.ZipFile(filename, 'w') z.writestr('hello.py', 'def f(): return "hello world from " + __file__\n') z.close() def import_and_run_module(): import hello print hello.f() def main(): fhandle, filen...
StarcoderdataPython
52912
<filename>thirdparty_xentax/test_extraction.py # -*- coding: utf-8 -*- import phyre, importlib, os importlib.reload(phyre) # 1 or 2 ffx=1 # pc, npc, mon, obj, skl, sum, or wep tp = 'pc' # model number (no leading zeros) num = 106 ffxBaseDir=r'C:\SteamLibrary\steamapps\common\FINAL FANTASY FFX&FFX-2 H...
StarcoderdataPython
150658
from ferris import BasicModel, ndb import logging class Main(BasicModel): criteria = ndb.StringProperty() data = ndb.JsonProperty() permissions = ndb.JsonProperty() resolved = ndb.BooleanProperty() @classmethod def create(cls, params): entity = cls.get(params['criteria']) if ...
StarcoderdataPython
161470
# Name: <NAME> and <NAME> # Date: 7/10/18 import random """ proj 03: Guessing Game Generate a random number between 1 and 9 (including 1 and 9). Ask the user to guess the number, then tell them whether they guessed too low, too high, or exactly right. Keep the game going until the user types exit. Keep track of ho...
StarcoderdataPython
1659567
<filename>engine/test/mock_app/mock_stream_timeout.py import asyncio from hopeit.app.logger import app_extra_logger from hopeit.app.context import EventContext __steps__ = ['wait'] from mock_app import MockData, MockResult logger, extra = app_extra_logger() async def wait(payload: MockData, context: EventContext)...
StarcoderdataPython
1799818
from bokeh.plotting import figure from bokeh.layouts import column from bokeh.io import export_png, show from bokeh.palettes import Category20 from sklearn.decomposition import PCA import holoviews as hv from holoviews.operation import gridmatrix import numpy as np import pandas as pd import os if not os.path.exists("...
StarcoderdataPython
1661548
import logging.config from pathlib import Path import sqlite3 import yaml # configuring logging with open('log_config.yaml', 'r') as f: log_config = yaml.safe_load(f.read()) logging.config.dictConfig(log_config) logger = logging.getLogger(__name__) class BooksPipeline(object): def __init__(self): ...
StarcoderdataPython
1667068
<gh_stars>0 import math from functools import lru_cache, partial from typing import List, Tuple, Optional, Mapping import numpy as np import pandas as pd from .exp_center import exp_center_file_in_directory from .input import find_input_file_in_directory, get_input_values, _OUTPUT_NAMES from .log import log_process f...
StarcoderdataPython
4816797
<reponame>npvisual/fondat-aws import pytest import asyncio from fondat.aws import Client, Config from fondat.aws.secrets import Secret, secrets_resource from fondat.error import BadRequestError, NotFoundError from uuid import uuid4 pytestmark = pytest.mark.asyncio config = Config( endpoint_url="http://localho...
StarcoderdataPython
1724993
from .image import subimage_by_roi import astimp class Antibiotic(): "an antibiotic tested in an AST" def __init__(self, short_name, pellet_circle, inhibition, image, roi, px_per_mm): self.short_name = short_name self.pellet_circle = pellet_circle self.inhibition = inhibition s...
StarcoderdataPython
1740906
# flake8: noqa from .charts_options import ( BarItem, BarBackgroundStyleOpts, BMapCopyrightTypeOpts, BMapGeoLocationControlOpts, BMapNavigationControlOpts, BMapOverviewMapControlOpts, BMapScaleControlOpts, BMapTypeControlOpts, BoxplotItem, CandleStickItem, Compo...
StarcoderdataPython
127049
<reponame>jakelong0509/master """import numpy as np import matplotlib.pyplot as plt class Grid: def __init__(self, height, weight, start): self.height = height self.weight = weight self.i = start[0] self.j = start[1] def set(self, rewards, actions): self.rewa...
StarcoderdataPython
40290
import sys from logs.logger import log from utils import check_internet , get_public_ip import bot if __name__ == "__main__": if check_internet() is True: try: log.info(f'Internet connection found : {get_public_ip()}') bot.run() except KeyboardInterrupt: # quit ...
StarcoderdataPython
156374
<gh_stars>1-10 import numpy as np import json import sys import os import pandas as pd # To parse and dump JSON from kafka import KafkaConsumer # Import Kafka consumer from kafka import KafkaProducer # Import Kafka producer import pickle # Library to save and load ML regressors usi...
StarcoderdataPython
1688378
<reponame>julpark-rh/cephci """ Entry module for executing RBD test scripts from ceph-qe-scripts. This acts as a wrapper around the automation scripts in ceph-qe-scripts for cephci. The following things are done - Call the appropriate test script - Return the status code of the script. """ from utility.log import Log...
StarcoderdataPython
1673801
<gh_stars>10-100 """baseline Revision ID: c7b63286fd71 Revises: Create Date: 2021-05-27 21:56:12.258456 """ from alembic import op import sqlalchemy as sa from sqlalchemy.engine.reflection import Inspector # revision identifiers, used by Alembic. revision = 'c7b63286fd71' down_revision = None branch_labels = None de...
StarcoderdataPython
49281
<filename>gogolook/models/task.py from enum import IntEnum from typing import Optional from pydantic import Field from sqlalchemy import Column, Enum, String from gogolook.models import Base, BaseSchema class TaskStatus(IntEnum): Incomplete = 0 Complete = 1 class Task(Base): name = Column(String(lengt...
StarcoderdataPython
52403
from flask_login import AnonymousUserMixin from flask_login import UserMixin as BaseUserMixin from werkzeug.datastructures import ImmutableList from ayeauth import db from ayeauth.auth.password import <PASSWORD>_password from ayeauth.models import BaseModel class UserMixin(BaseUserMixin): @property def is_ac...
StarcoderdataPython
1616814
# 反转链表 # 输入一个链表,反转链表后,输出新链表的表头。 # 链表结构 class ListNode: def __init__(self, x): self.val = x self.next = None # 打印链表 def printChain(head): node = head while node: print(node.val) node = node.next class Solution: def ReverseList(self, pHead): if pHead == None: ...
StarcoderdataPython
3316841
<filename>hackerrank/Python/Strings/Print-Fucntion.py<gh_stars>0 #Represent all int values before stdin print(*range(1, int(input())+1), sep='')
StarcoderdataPython
1621239
<filename>api/src/opentrons/protocol_engine/resources/model_utils.py """Unique ID generation provider.""" from datetime import datetime, timezone from uuid import uuid4 class ModelUtils: """Common resource model utilities provider.""" @staticmethod def generate_id() -> str: """Generate a unique i...
StarcoderdataPython
3317529
<gh_stars>0 # Copyright 2017 Apex.AI, Inc. # flake8: noqa This file is for plotting data. Its dependencies are not necessarily on the CI. import os import sys import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt # noqa: if len(sys.argv) == 2: directory = sys.argv[1] else: p...
StarcoderdataPython
114342
<reponame>christopher-roelofs/MiSTerDash<gh_stars>0 from time import sleep import json import config from flask import Flask, Response, render_template import time app = Flask(__name__) quit = False SETTINGS = config.get_config() RECENTS_FOLDER = '/media/{}/config/'.format(SETTINGS['core_storage']) details = {} @ap...
StarcoderdataPython
92791
<filename>refinery/lib/deobfuscation.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Contains functions to aid in deobfuscation. """ from typing import Optional, Any import ast import re class ExpressionParsingFailure(ValueError): pass _ALLOWED_NODE_TYPES = frozenset({ ast.Add, ast.BinOp, ast...
StarcoderdataPython
1646925
<gh_stars>10-100 # coding: utf-8 import ncloud_cdn from ncloud_cdn.api.v2_api import V2Api from ncloud_cdn.rest import ApiException import ncloud_apikey configuration = ncloud_cdn.Configuration() apikeys = ncloud_apikey.ncloud_key.NcloudKey().keys() configuration.access_key = apikeys['access_key'] # "<KEY>" configur...
StarcoderdataPython
1718560
<reponame>Kittycatguspm/shuecm """ Place this db models. """
StarcoderdataPython
3214893
<gh_stars>10-100 #!/usr/bin/env python __all__ = [ "RequestPacket", "ResponsePacket" ] from CraftProtocol.Protocol.v1_8.Packet.Status.RequestPacket import RequestPacket from CraftProtocol.Protocol.v1_8.Packet.Status.ResponsePacket import ResponsePacket
StarcoderdataPython
7934
def execucoes(): return int(input()) def entradas(): return input().split(' ') def imprimir(v): print(v) def tamanho_a(a): return len(a) def tamanho_b(b): return len(b) def diferenca_tamanhos(a, b): return (len(a) <= len(b)) def analisar(e, i, s): a, b = e if(diferenca_tamanhos(a, ...
StarcoderdataPython
1740753
<filename>mars/tensor/execution/tests/test_datasource_execute.py #!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2018 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 o...
StarcoderdataPython
1730685
<filename>Cap 11/rascunho.py # -*- coding: utf-8 -*- """ Created on Tue May 19 01:44:14 2020 @author: dreis """ def histogram(s): d = dict() for c in s: if c not in d: d[c] = 1 else: d[c] += 1 return print(d) def histogram_get(s): d = dict() for letra in ...
StarcoderdataPython
157862
<filename>nematus/metrics/test_chrf.py #!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from chrf import CharacterFScorer class TestCharacterFScoreReference(unittest.TestCase): """ Regression tests for SmoothedBleuReference """ @staticmethod def tokenize(sentence): return sen...
StarcoderdataPython
3249237
<filename>app.py<gh_stars>0 import graphviz as graphviz import streamlit as st from modules import helper_module_app as helper st.set_option('deprecation.showPyplotGlobalUse', False) def main(): """ glues all parts together """ st.sidebar.title("Model configurations") st.title("Topic discovering...
StarcoderdataPython
54088
<reponame>CCC-CS-github/ursina_ks3<gh_stars>1-10 """ private dev for the PythonCraft code -- i.e. in case I break the original, PythonCraft.py. Also -- I want the original kept to approx. 30 lines. """ # Import the ursina module, and its First Person character. from ursina import * # Import the Perlin Noise module for ...
StarcoderdataPython
3385199
<reponame>ablot/Pinceau # -*- coding: utf-8 -*- from PyQt4.QtCore import * from PyQt4.QtGui import * import ui_graphDlg import matplotlib.image as mpimg class graphDlg(QDialog, ui_graphDlg.Ui_graphDialog): def __init__(self,parent=None,debug=0): super(graphDlg, self).__init__(parent) self.setupU...
StarcoderdataPython
3294439
<reponame>ckamtsikis/cmssw<gh_stars>100-1000 import FWCore.ParameterSet.Config as cms egmGedGsfElectronPFNoPileUpIsolation = cms.EDProducer( "CITKPFIsolationSumProducer", srcToIsolate = cms.InputTag("gedGsfElectrons"), srcForIsolationCone = cms.InputTag('pfNoPileUpCandidates'), isolationConeDefinitions...
StarcoderdataPython
1727781
<reponame>sasha-kantoriz/ocdsapi<filename>tests/test_records.py<gh_stars>0 from .base import storage, app from werkzeug.exceptions import NotFound def test_get(client, storage): with client.get('/api/record.json?ocid=test_ocid') as response: assert response.json['releases'][0] == storage.get_ocid('test_oc...
StarcoderdataPython
37251
<reponame>timkrentz/SunTracker import sys # Override theSystemPath so it throws KeyError on gi.pygtkcompat: from twisted.python import modules modules.theSystemPath = modules.PythonPath([], moduleDict={}) # Now, when we import gireactor it shouldn't use pygtkcompat, and should # instead prevent gobject from be...
StarcoderdataPython
3345836
# -*- coding: utf-8 -*- """ @description: warnings @author:Yee """ from __future__ import print_function from __future__ import unicode_literals # 引入警告模块 import warnings # 我们使用 warnings 中的 warn 函数: # warn(msg, WarningType = UserWarning) def month_warining(m): if not 1 <= m <= 12: msg = "month (%d) is no...
StarcoderdataPython
3239552
""" Based on https://djangosnippets.org/snippets/1179/ """ import django from django.conf import settings as django_settings from django.http import HttpResponseRedirect from re import compile from django_auth_adfs.config import settings from django_auth_adfs.util import get_adfs_auth_url try: from django.urls im...
StarcoderdataPython
3368296
<reponame>oist-cnru/VCBot #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ BSD 3-Clause License Copyright (c) 2020 Okinawa Institute of Science and Technology (OIST). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the follow...
StarcoderdataPython
1666934
from cryptography.fernet import Fernet, InvalidToken from django.conf import settings class Fern: # """ # Usage: # encrypt('foo') # decrypt('CIPHERTEXT_ENCRYPTED_TEXT') # """ def __init__(self, key=None): if key: self.key = key else: self.key = setting...
StarcoderdataPython
1629508
<filename>api/estimator/serializers.py<gh_stars>0 from rest_framework import serializers from estimator.models import LogsModel class LogsSerializer(serializers.ModelSerializer): class Meta: model = LogsModel fields = ('id', 'method', 'endpoint', 'status', 'response_time')
StarcoderdataPython
3249202
#!/usr/bin/env python import sys input = sys.stdin.readline print = sys.stdout.write if __name__ == '__main__': for _ in range(int(input())): n = int(input()) x = list(map(int, input().strip().split())) y = list(map(int, input().strip().split())) a = b = 0 for j, (zi, i) ...
StarcoderdataPython
1791548
<reponame>mbelda/GCOM # -*- coding: utf-8 -*- """ Created on Wed Feb 26 12:33:47 2020 @author: Majo """ import numpy as np iteraciones = 50 epsilon = 1e-40 def H(d): #lim delta -> 0 suma = 0 i = iteraciones delta = (1/3)**i #suma normas 1 ^d suma = 8**i * delta**2**d return suma ...
StarcoderdataPython
1635105
import re from typing import List from compile_md import get_md_files LECTION_FILE_REGEXP = r"lec4_(\d+).*?.md" def group_report(ids: List[int], start_id: int, end_id: int, group_name: str = "unknown"): group_ids = list(range(start_id, end_id+1)) done_count = len(list(filter(lambda x: x in ids, group_ids))) ...
StarcoderdataPython
198815
<reponame>bperez7/moments_models import torch from collections import OrderedDict def inflate_from_2d_model(state_dict_2d, state_dict_3d, skipped_keys=None, inflated_dim=2): if skipped_keys is None: skipped_keys = [] missed_keys = [] new_keys = [] for old_key in state_dict_2d.keys(): ...
StarcoderdataPython
1730418
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.CaptureCreateOrder import CaptureCreateOrder class AlipayBossFncSettleCaptureCreateModel(object): def __init__(self): self._capture_create_order_li...
StarcoderdataPython
4825238
# -*- coding: utf-8 -*- # Copyright 2018-2021 releng-tool class RelengPackage: """ a releng package A package tracks the name, options and dependencies of the package. Args: name: the name of the package Attributes: asc_file: file containing ascii-armored data to validate this pa...
StarcoderdataPython
124978
<filename>project_3_genetic_algorithms_using_binear_string.py import math import time import matplotlib.pyplot as plt from random import random, randint, uniform def function_f1(x1, x2): out = x2+10**(-5)*(x2-x1)**2-1 return out def function_f2(x1, x2): out = 1/(27*math.sqrt(3))*((x1-3)**2-9)*x2**3 r...
StarcoderdataPython
7403
# coding: utf-8 """ Isilon SDK Isilon SDK - Language bindings for the OneFS API # noqa: E501 OpenAPI spec version: 3 Contact: <EMAIL> Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class AuthAccessAccessItemFile(object):...
StarcoderdataPython
4816785
N = int(input()) C = N // 100 if N % 100 == 0: print(C) else: print(C + 1)
StarcoderdataPython
27754
from django.db import models # Description of an object in the arena class Entity(models.Model): entityId = models.AutoField(primary_key=True) entityClass = models.CharField(max_length=30) entityName = models.CharField(max_length=30, null=True, blank=True) entityCategory = models.CharField(max_length=...
StarcoderdataPython
1759899
<filename>foxylib/tools/network/http/formdata_tool.py import io import os from foxylib.tools.file.file_tool import FileTool class FormdataTool: @classmethod def filepath2item(cls, filepath): # https://stackoverflow.com/a/35712344 bytes = FileTool.filepath2bytes(filepath) basename = os...
StarcoderdataPython
3362767
<gh_stars>1-10 from datetime import datetime from typing import List, Dict import src.dfa as dfa from src.api.weather import WeatherAPI, ResponseStatus, WeatherDescription, WeatherTime from src.parse.intent import Intent, Command class GetCityWeatherState(dfa.BaseState): _disable_message = "Модуль погоды ушёл в...
StarcoderdataPython