add examples
Browse files
app.py
CHANGED
@@ -75,7 +75,7 @@ def predict(patch, max_length, min_length, num_beams, prediction_count):
|
|
75 |
|
76 |
iface = gr.Interface(fn=predict, inputs=[
|
77 |
gr.Textbox(label="Patch (as generated by git diff)"),
|
78 |
-
gr.Slider(1, 128, value=
|
79 |
gr.Slider(1, 128, value=5, label="Min message length"),
|
80 |
gr.Slider(1, 10, value=7, label="Number of beams"),
|
81 |
gr.Slider(1, 15, value=5, label="Number of predictions"),
|
@@ -83,7 +83,133 @@ iface = gr.Interface(fn=predict, inputs=[
|
|
83 |
gr.Textbox(label="Token count"),
|
84 |
gr.Textbox(label="Parsed patch"),
|
85 |
gr.Label(label="Predictions")
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
if __name__ == "__main__":
|
89 |
iface.launch()
|
|
|
75 |
|
76 |
iface = gr.Interface(fn=predict, inputs=[
|
77 |
gr.Textbox(label="Patch (as generated by git diff)"),
|
78 |
+
gr.Slider(1, 128, value=40, label="Max message length"),
|
79 |
gr.Slider(1, 128, value=5, label="Min message length"),
|
80 |
gr.Slider(1, 10, value=7, label="Number of beams"),
|
81 |
gr.Slider(1, 15, value=5, label="Number of predictions"),
|
|
|
83 |
gr.Textbox(label="Token count"),
|
84 |
gr.Textbox(label="Parsed patch"),
|
85 |
gr.Label(label="Predictions")
|
86 |
+
], examples=[
|
87 |
+
["""
|
88 |
+
diff --git a/.github/workflows/pylint.yml b/.github/workflows/codestyle_checks.yml
|
89 |
+
similarity index 86%
|
90 |
+
rename from .github/workflows/pylint.yml
|
91 |
+
rename to .github/workflows/codestyle_checks.yml
|
92 |
+
index a5d5c4d9..8cbf9713 100644
|
93 |
+
--- a/.github/workflows/pylint.yml
|
94 |
+
+++ b/.github/workflows/codestyle_checks.yml
|
95 |
+
@@ -20,3 +20,6 @@ jobs:
|
96 |
+
- name: Analysing the code with pylint
|
97 |
+
run: |
|
98 |
+
pylint --rcfile=.pylintrc webapp core
|
99 |
+
+ - name: Analysing the code with flake8
|
100 |
+
+ run: |
|
101 |
+
+ flake8
|
102 |
+
""", 40, 5, 7, 5],
|
103 |
+
["""
|
104 |
+
diff --git a/packages/react-native-renderer/src/ReactFabricHostConfig.js b/packages/react-native-renderer/src/ReactFabricHostConfig.js
|
105 |
+
index 078bf1f11ac6..b6d370882ae4 100644
|
106 |
+
--- a/packages/react-native-renderer/src/ReactFabricHostConfig.js
|
107 |
+
+++ b/packages/react-native-renderer/src/ReactFabricHostConfig.js
|
108 |
+
@@ -18,7 +18,10 @@ import type {
|
109 |
+
TouchedViewDataAtPoint,
|
110 |
+
} from './ReactNativeTypes';
|
111 |
+
|
112 |
+
-import {mountSafeCallback_NOT_REALLY_SAFE} from './NativeMethodsMixinUtils';
|
113 |
+
+import {
|
114 |
+
+ mountSafeCallback_NOT_REALLY_SAFE,
|
115 |
+
+ warnForStyleProps,
|
116 |
+
+} from './NativeMethodsMixinUtils';
|
117 |
+
import {create, diff} from './ReactNativeAttributePayload';
|
118 |
+
|
119 |
+
import {dispatchEvent} from './ReactFabricEventEmitter';
|
120 |
+
@@ -52,6 +55,7 @@ const {
|
121 |
+
unstable_DefaultEventPriority: FabricDefaultPriority,
|
122 |
+
unstable_DiscreteEventPriority: FabricDiscretePriority,
|
123 |
+
unstable_getCurrentEventPriority: fabricGetCurrentEventPriority,
|
124 |
+
+ setNativeProps,
|
125 |
+
} = nativeFabricUIManager;
|
126 |
+
|
127 |
+
const {get: getViewConfigForType} = ReactNativeViewConfigRegistry;
|
128 |
+
@@ -208,12 +212,14 @@ class ReactFabricHostComponent {
|
129 |
+
|
130 |
+
setNativeProps(nativeProps: Object) {
|
131 |
+
if (__DEV__) {
|
132 |
+
- console.error(
|
133 |
+
- 'Warning: setNativeProps is not currently supported in Fabric',
|
134 |
+
- );
|
135 |
+
+ warnForStyleProps(nativeProps, this.viewConfig.validAttributes);
|
136 |
+
}
|
137 |
+
+ const updatePayload = create(nativeProps, this.viewConfig.validAttributes);
|
138 |
+
|
139 |
+
- return;
|
140 |
+
+ const {stateNode} = this._internalInstanceHandle;
|
141 |
+
+ if (stateNode != null && updatePayload != null) {
|
142 |
+
+ setNativeProps(stateNode.node, updatePayload);
|
143 |
+
+ }
|
144 |
+
}
|
145 |
+
|
146 |
+
// This API (addEventListener, removeEventListener) attempts to adhere to the
|
147 |
+
diff --git a/packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/InitializeNativeFabricUIManager.js b/packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/InitializeNativeFabricUIManager.js
|
148 |
+
index abb2883d387e..ab4fc291d6d6 100644
|
149 |
+
--- a/packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/InitializeNativeFabricUIManager.js
|
150 |
+
+++ b/packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/InitializeNativeFabricUIManager.js
|
151 |
+
@@ -117,6 +117,8 @@ const RCTFabricUIManager = {
|
152 |
+
|
153 |
+
dispatchCommand: jest.fn(),
|
154 |
+
|
155 |
+
+ setNativeProps: jest.fn(),
|
156 |
+
+
|
157 |
+
sendAccessibilityEvent: jest.fn(),
|
158 |
+
|
159 |
+
registerEventHandler: jest.fn(function registerEventHandler(callback) {}),
|
160 |
+
diff --git a/packages/react-native-renderer/src/__tests__/ReactFabricHostComponent-test.internal.js b/packages/react-native-renderer/src/__tests__/ReactFabricHostComponent-test.internal.js
|
161 |
+
index 337a4976bbe8..51e056d1c8bc 100644
|
162 |
+
--- a/packages/react-native-renderer/src/__tests__/ReactFabricHostComponent-test.internal.js
|
163 |
+
+++ b/packages/react-native-renderer/src/__tests__/ReactFabricHostComponent-test.internal.js
|
164 |
+
@@ -38,7 +38,7 @@ function mockRenderKeys(keyLists) {
|
165 |
+
|
166 |
+
const mockContainerTag = 11;
|
167 |
+
const MockView = createReactNativeComponentClass('RCTMockView', () => ({
|
168 |
+
- validAttributes: {},
|
169 |
+
+ validAttributes: {foo: true},
|
170 |
+
uiViewClassName: 'RCTMockView',
|
171 |
+
}));
|
172 |
+
|
173 |
+
@@ -200,21 +200,15 @@ describe('measureLayout', () => {
|
174 |
+
});
|
175 |
+
|
176 |
+
describe('setNativeProps', () => {
|
177 |
+
- test('setNativeProps(...) emits a warning', () => {
|
178 |
+
+ test('setNativeProps(...) invokes setNativeProps on Fabric UIManager', () => {
|
179 |
+
const {
|
180 |
+
UIManager,
|
181 |
+
} = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface');
|
182 |
+
|
183 |
+
const [[fooRef]] = mockRenderKeys([['foo']]);
|
184 |
+
+ fooRef.setNativeProps({foo: 'baz'});
|
185 |
+
|
186 |
+
- expect(() => {
|
187 |
+
- fooRef.setNativeProps({});
|
188 |
+
- }).toErrorDev(
|
189 |
+
- ['Warning: setNativeProps is not currently supported in Fabric'],
|
190 |
+
- {
|
191 |
+
- withoutStack: true,
|
192 |
+
- },
|
193 |
+
- );
|
194 |
+
expect(UIManager.updateView).not.toBeCalled();
|
195 |
+
+ expect(nativeFabricUIManager.setNativeProps).toHaveBeenCalledTimes(1);
|
196 |
+
});
|
197 |
+
});
|
198 |
+
diff --git a/scripts/flow/react-native-host-hooks.js b/scripts/flow/react-native-host-hooks.js
|
199 |
+
index 584f24ee084c..e3c98114935f 100644
|
200 |
+
--- a/scripts/flow/react-native-host-hooks.js
|
201 |
+
+++ b/scripts/flow/react-native-host-hooks.js
|
202 |
+
@@ -186,7 +186,7 @@ declare var nativeFabricUIManager: {
|
203 |
+
payload: Object,
|
204 |
+
) => void,
|
205 |
+
) => void,
|
206 |
+
-
|
207 |
+
+ setNativeProps: (node: Object, nativeProps: Object) => Object,
|
208 |
+
dispatchCommand: (node: Object, command: string, args: Array<any>) => void,
|
209 |
+
sendAccessibilityEvent: (node: Object, eventTypeName: string) => void,
|
210 |
+
""", 40, 5, 7, 5]
|
211 |
+
]
|
212 |
+
)
|
213 |
|
214 |
if __name__ == "__main__":
|
215 |
iface.launch()
|